Skip to content

Commit

Permalink
HHH-18337 - SequenceStyleGenerator not respecting physical naming str…
Browse files Browse the repository at this point in the history
…ategy
  • Loading branch information
sebersole committed Sep 16, 2024
1 parent efd4528 commit 3e215b5
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ public void create(GeneratorCreationContext creationContext) throws MappingExcep

@Override
public void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) throws MappingException {
if ( physicalNamingStrategy == null ) {
throw new IllegalStateException( "Expecting prior call to #create" );
}

final JdbcEnvironment jdbcEnvironment = serviceRegistry.requireService( JdbcEnvironment.class );
final Dialect dialect = jdbcEnvironment.getDialect();

Expand Down Expand Up @@ -279,9 +275,9 @@ private int adjustIncrementSize(
if ( sequenceMismatchStrategy != SequenceMismatchStrategy.NONE
&& optimizationStrategy.isPooled()
&& physicalSequence ) {
final String databaseSequenceName = physicalNamingStrategy
.toPhysicalSequenceName( sequenceName.getObjectName(), jdbcEnvironment )
.getText();
final String databaseSequenceName = physicalNamingStrategy != null
? physicalNamingStrategy.toPhysicalSequenceName( sequenceName.getObjectName(), jdbcEnvironment ).getText()
: sequenceName.getObjectName().getText();
final Number databaseIncrementValue = isSchemaToBeRecreated( contributor, configurationService ) ? null : getSequenceIncrementValue( jdbcEnvironment, databaseSequenceName );
if ( databaseIncrementValue != null && databaseIncrementValue.intValue() != incrementSize) {
final int dbIncrementValue = databaseIncrementValue.intValue();
Expand Down

0 comments on commit 3e215b5

Please sign in to comment.