Example usage for org.hibernate.engine.jdbc.env.spi JdbcEnvironment getDialect

List of usage examples for org.hibernate.engine.jdbc.env.spi JdbcEnvironment getDialect

Introduction

In this page you can find the example usage for org.hibernate.engine.jdbc.env.spi JdbcEnvironment getDialect.

Prototype

Dialect getDialect();

Source Link

Document

Get the dialect for this environment.

Usage

From source file:com.tsoft.app.domain.identifier.StringSequenceIdentifier.java

@Override
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
    final JdbcEnvironment jdbcEnvironment = serviceRegistry.getService(JdbcEnvironment.class);
    final Dialect dialect = jdbcEnvironment.getDialect();

    final ConfigurationService configurationService = serviceRegistry.getService(ConfigurationService.class);
    String globalEntityIdentifierPrefix = configurationService.getSetting("entity.identifier.prefix",
            String.class, "SEQ_");

    sequencePrefix = ConfigurationHelper.getString(SEQUENCE_PREFIX, params, globalEntityIdentifierPrefix);

    final String sequencePerEntitySuffix = ConfigurationHelper.getString(
            SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params,
            SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX);

    final String defaultSequenceName = ConfigurationHelper
            .getBoolean(SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false)
                    ? params.getProperty(JPA_ENTITY_NAME) + sequencePerEntitySuffix
                    : SequenceStyleGenerator.DEF_SEQUENCE_NAME;

    sequenceCallSyntax = dialect.getSequenceNextValString(
            ConfigurationHelper.getString(SequenceStyleGenerator.SEQUENCE_PARAM, params, defaultSequenceName));
}

From source file:net.e6tech.elements.persist.hibernate.ModifiedTableGenerator.java

License:Apache License

/**
 * Determine the name of the column used to indicate the segment for each
 * row.  This column acts as the primary key.
 *
 * Called during {@link #configure configuration}.
 *
 * @see #getSegmentColumnName()/*from  w ww.  j ava  2  s  .com*/
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param jdbcEnvironment The JDBC environment
 * @return The name of the segment column
 */
@SuppressWarnings("UnusedParameters")
protected String determineSegmentColumnName(Properties params, JdbcEnvironment jdbcEnvironment) {
    final String name = ConfigurationHelper.getString(SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN);
    return jdbcEnvironment.getIdentifierHelper().toIdentifier(name).render(jdbcEnvironment.getDialect());
}

From source file:net.e6tech.elements.persist.hibernate.ModifiedTableGenerator.java

License:Apache License

/**
 * Determine the name of the column in which we will store the generator persistent value.
 *
 * Called during {@link #configure configuration}.
 *
 * @see #getValueColumnName()/*  w  w  w  . ja v a  2 s .co m*/
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param jdbcEnvironment The JDBC environment
 * @return The name of the value column
 */
@SuppressWarnings("UnusedParameters")
protected String determineValueColumnName(Properties params, JdbcEnvironment jdbcEnvironment) {
    final String name = ConfigurationHelper.getString(VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN);
    return jdbcEnvironment.getIdentifierHelper().toIdentifier(name).render(jdbcEnvironment.getDialect());
}