org.hibernate.boot.model.relational.Sequence Java Examples

The following examples show how to use org.hibernate.boot.model.relational.Sequence. 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: AbstractSchemaValidator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected void validateSequence(Sequence sequence, SequenceInformation sequenceInformation) {
	if ( sequenceInformation == null ) {
		throw new SchemaManagementException(
				String.format( "Schema-validation: missing sequence [%s]", sequence.getName() )
		);
	}

	if ( sequenceInformation.getIncrementSize() > 0
			&& sequence.getIncrementSize() != sequenceInformation.getIncrementSize() ) {
		throw new SchemaManagementException(
				String.format(
						"Schema-validation: sequence [%s] defined inconsistent increment-size; found [%s] but expecting [%s]",
						sequence.getName(),
						sequenceInformation.getIncrementSize(),
						sequence.getIncrementSize()
				)
		);
	}
}
 
Example #2
Source File: SequenceStructure.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected void buildSequence(Database database) {
	final int sourceIncrementSize = getSourceIncrementSize();

	final Namespace namespace = database.locateNamespace(
			logicalQualifiedSequenceName.getCatalogName(),
			logicalQualifiedSequenceName.getSchemaName()
	);
	Sequence sequence = namespace.locateSequence( logicalQualifiedSequenceName.getObjectName() );
	if ( sequence != null ) {
		sequence.validate( initialValue, sourceIncrementSize );
	}
	else {
		sequence = namespace.createSequence( logicalQualifiedSequenceName.getObjectName(), initialValue, sourceIncrementSize );
	}

	this.sequenceName = database.getJdbcEnvironment().getQualifiedObjectNameFormatter().format(
			sequence.getName(),
			database.getJdbcEnvironment().getDialect()
	);
}
 
Example #3
Source File: StandardSequenceExporter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String[] getSqlCreateStrings(Sequence sequence, Metadata metadata) {
	final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
	return dialect.getCreateSequenceStrings(
			jdbcEnvironment.getQualifiedObjectNameFormatter().format(
					sequence.getName(),
					jdbcEnvironment.getDialect()
			),
			sequence.getInitialValue(),
			sequence.getIncrementSize()
	);
}
 
Example #4
Source File: StandardSequenceExporter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String[] getSqlDropStrings(Sequence sequence, Metadata metadata) {
	final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
	return dialect.getDropSequenceStrings(
			jdbcEnvironment.getQualifiedObjectNameFormatter().format(
					sequence.getName(),
					jdbcEnvironment.getDialect()
			)
	);
}
 
Example #5
Source File: SequenceGenerator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void registerExportables(Database database) {
	final Namespace namespace = database.locateNamespace(
			logicalQualifiedSequenceName.getCatalogName(),
			logicalQualifiedSequenceName.getSchemaName()
	);
	Sequence sequence = namespace.locateSequence( logicalQualifiedSequenceName.getObjectName() );
	if ( sequence != null ) {
		sequence.validate( 1, 1 );
	}
	else {
		sequence = namespace.createSequence(
				logicalQualifiedSequenceName.getObjectName(),
				1,
				1
		);
	}

	final JdbcEnvironment jdbcEnvironment = database.getJdbcEnvironment();
	final Dialect dialect = jdbcEnvironment.getDialect();

	this.sequenceName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
			sequence.getName(),
			dialect
	);
	this.sql = jdbcEnvironment.getDialect().getSequenceNextValString( sequenceName );
}
 
Example #6
Source File: SpannerDialect.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Exporter<Sequence> getSequenceExporter() {
  return NOOP_EXPORTER;
}
 
Example #7
Source File: DefaultSchemaFilter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean includeSequence( Sequence sequence ) {
	return true;
}
 
Example #8
Source File: Dialect.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public Exporter<Sequence> getSequenceExporter() {
	return sequenceExporter;
}
 
Example #9
Source File: NoSequenceFilterProvider.java    From jpa2ddl with Apache License 2.0 4 votes vote down vote up
@Override
public boolean includeSequence(Sequence sequence) {
	return false;
}
 
Example #10
Source File: DelegatingDialect.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public Exporter<Sequence> getSequenceExporter() {
    return getInstance().getSequenceExporter();
}
 
Example #11
Source File: SchemaFilter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Should the given sequence be included?  If {@code true}, the
 * sequence will be further processed; if {@code false}, processing will skip this
 * sequence.
 *
 * @param sequence The sequence to check for inclusion
 *
 * @return {@code true} to include the sequence; {@code false} otherwise
 */
boolean includeSequence(Sequence sequence);