@@ -520,39 +520,41 @@ private IntegralDataTypeHolder makeValue() {
520520}
521521
522522@ Override
523- public Object generate (final SharedSessionContractImplementor session , final Object obj ) {
524- final var statementLogger =
525- session . getFactory (). getJdbcServices ()
526- . getSqlStatementLogger ();
527- final var statsCollector = session . getEventListenerManager ();
528- return optimizer . generate (
529- new AccessCallback () {
530- @ Override
531- public IntegralDataTypeHolder getNextValue ( ) {
532- return session . getTransactionCoordinator (). createIsolationDelegate (). delegateWork (
533- new AbstractReturningWork <>() {
534- @ Override
535- public IntegralDataTypeHolder execute ( Connection connection ) throws SQLException {
536- return nextValue ( connection , statementLogger , statsCollector , session );
537- }
538- },
539- true
540- );
541- }
542- @ Override
543- public String getTenantIdentifier () {
544- return session . getTenantIdentifier ();
545- }
546- }
547- );
523+ public Object generate (final SharedSessionContractImplementor session , final Object object ) {
524+ return optimizer . generate ( new NextValueCallback ( session ) );
525+ }
526+
527+ private class NextValueCallback
528+ extends AbstractReturningWork < IntegralDataTypeHolder >
529+ implements AccessCallback {
530+ private final SharedSessionContractImplementor session ;
531+ private NextValueCallback ( SharedSessionContractImplementor session ) {
532+ this . session = session ;
533+ }
534+ @ Override
535+ public IntegralDataTypeHolder getNextValue () {
536+ return session . getTransactionCoordinator (). createIsolationDelegate ()
537+ . delegateWork ( this , true );
538+ }
539+ @ Override
540+ public IntegralDataTypeHolder execute ( Connection connection )
541+ throws SQLException {
542+ return nextValue ( connection , session );
543+ }
544+ @ Override
545+ public String getTenantIdentifier () {
546+ return session . getTenantIdentifier ();
547+ }
548548}
549549
550550private IntegralDataTypeHolder nextValue (
551551Connection connection ,
552- SqlStatementLogger logger ,
553- SessionEventListenerManager listener ,
554552SharedSessionContractImplementor session )
555- throws SQLException {
553+ throws SQLException {
554+ final var logger =
555+ session .getFactory ().getJdbcServices ()
556+ .getSqlStatementLogger ();
557+ final var listener = session .getEventListenerManager ();
556558final var value = makeValue ();
557559int rows ;
558560do {
@@ -636,7 +638,8 @@ private PreparedStatement prepareStatement(
636638String sql ,
637639SqlStatementLogger logger ,
638640SessionEventListenerManager listener ,
639- SharedSessionContractImplementor session ) throws SQLException {
641+ SharedSessionContractImplementor session )
642+ throws SQLException {
640643logger .logStatement ( sql , FormatStyle .BASIC .getFormatter () );
641644final var eventMonitor = session .getEventMonitor ();
642645final var creationEvent = eventMonitor .beginJdbcPreparedStatementCreationEvent ();
@@ -661,7 +664,8 @@ private int executeUpdate(
661664PreparedStatement ps ,
662665SessionEventListenerManager listener ,
663666String sql ,
664- SharedSessionContractImplementor session ) throws SQLException {
667+ SharedSessionContractImplementor session )
668+ throws SQLException {
665669final var eventMonitor = session .getEventMonitor ();
666670final var executionEvent = eventMonitor .beginJdbcPreparedStatementExecutionEvent ();
667671try {
@@ -678,7 +682,8 @@ private ResultSet executeQuery(
678682PreparedStatement ps ,
679683SessionEventListenerManager listener ,
680684String sql ,
681- SharedSessionContractImplementor session ) throws SQLException {
685+ SharedSessionContractImplementor session )
686+ throws SQLException {
682687final var eventMonitor = session .getEventMonitor ();
683688final var executionEvent = eventMonitor .beginJdbcPreparedStatementExecutionEvent ();
684689try {
@@ -784,7 +789,7 @@ public void initialize(SqlStringGenerationContext context) {
784789public static void applyConfiguration (
785790jakarta .persistence .TableGenerator generatorConfig ,
786791BiConsumer <String , String > configurationCollector ) {
787- configurationCollector .accept ( CONFIG_PREFER_SEGMENT_PER_ENTITY , " true" );
792+ configurationCollector .accept ( CONFIG_PREFER_SEGMENT_PER_ENTITY , String . valueOf ( true ) );
788793
789794applyIfNotEmpty ( TABLE_PARAM , generatorConfig .table (), configurationCollector );
790795applyIfNotEmpty ( CATALOG , generatorConfig .catalog (), configurationCollector );
0 commit comments