in google-cloud-spanner-hibernate-tools/src/main/java/com/google/cloud/spanner/hibernate/PooledBitReversedSequenceStyleGenerator.java [295:324]
private SequenceStructure buildDatabaseStructure(
String contributor,
Type type,
QualifiedSequenceName sequenceName,
int initialValue,
List<Range<Long>> excludeRanges,
JdbcEnvironment jdbcEnvironment) {
if (isPostgres()) {
return new BitReversedSequenceStructure(
jdbcEnvironment,
contributor,
sequenceName,
initialValue,
1,
excludeRanges,
type.getReturnedClass());
}
if (!excludeRanges.isEmpty()) {
// Put the excluded range in the catalog name. We have no other way of getting that
// information into the sequence. The SpannerSequenceExporter then extracts this information
// and removes the bogus catalog name.
sequenceName =
new QualifiedSequenceName(
Identifier.toIdentifier(buildSkipRangeOptions(excludeRanges)),
sequenceName.getSchemaName(),
sequenceName.getObjectName());
}
return new SequenceStructure(
jdbcEnvironment, contributor, sequenceName, initialValue, 1, type.getReturnedClass());
}