Java Code Examples for org.hibernate.dialect.Dialect#getSequenceNextValString()

The following examples show how to use org.hibernate.dialect.Dialect#getSequenceNextValString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SequenceReactiveIdentifierGenerator.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
	JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class );
	Dialect dialect = jdbcEnvironment.getDialect();

	qualifiedSequenceName = determineSequenceName( params, serviceRegistry );

	// allow physical naming strategies a chance to kick in
	String renderedSequenceName = jdbcEnvironment.getQualifiedObjectNameFormatter()
			.format( qualifiedSequenceName, dialect );

	sql = dialect.getSequenceNextValString( renderedSequenceName );
}
 
Example 2
Source File: SequenceGenerator.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	sequenceName = PropertiesHelper.getString(SEQUENCE, params, "hibernate_sequence");
	parameters = params.getProperty(PARAMETERS);
	String schemaName = params.getProperty(SCHEMA);
	String catalogName = params.getProperty(CATALOG);

	if (sequenceName.indexOf( '.' ) < 0) {
		sequenceName = Table.qualify( catalogName, schemaName, sequenceName );
	}

	this.identifierType = type;
	sql = dialect.getSequenceNextValString(sequenceName);
}
 
Example 3
Source File: SequenceStructure.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SequenceStructure(Dialect dialect, String sequenceName, int initialValue, int incrementSize) {
	this.sequenceName = sequenceName;
	this.initialValue = initialValue;
	this.incrementSize = incrementSize;
	sql = dialect.getSequenceNextValString( sequenceName );
}
 
Example 4
Source File: StringSequenceIdentifier.java    From high-performance-java-persistence with Apache License 2.0 4 votes vote down vote up
@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
    );

    boolean preferSequencePerEntity = ConfigurationHelper.getBoolean(
        SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY,
        params,
        false
    );

    final String defaultSequenceName = preferSequencePerEntity
            ? params.getProperty(JPA_ENTITY_NAME) + sequencePerEntitySuffix
            : SequenceStyleGenerator.DEF_SEQUENCE_NAME;

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