diff --git a/hibernate-core/src/main/java/org/hibernate/sql/model/jdbc/OptionalTableUpdateOperation.java b/hibernate-core/src/main/java/org/hibernate/sql/model/jdbc/OptionalTableUpdateOperation.java index 52b10472b1..e213f3cc59 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/model/jdbc/OptionalTableUpdateOperation.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/model/jdbc/OptionalTableUpdateOperation.java @@ -263,7 +263,10 @@ public class OptionalTableUpdateOperation implements SelfExecutingUpdateOperatio } } - private JdbcDeleteMutation createJdbcDelete(SharedSessionContractImplementor session) { + /* + * Used by Hibernate Reactive + */ + protected JdbcDeleteMutation createJdbcDelete(SharedSessionContractImplementor session) { final TableDelete tableDelete; if ( tableMapping.getDeleteDetails() != null && tableMapping.getDeleteDetails().getCustomSql() != null ) { @@ -305,39 +308,7 @@ public class OptionalTableUpdateOperation implements SelfExecutingUpdateOperatio JdbcValueBindings jdbcValueBindings, SharedSessionContractImplementor session) { MODEL_MUTATION_LOGGER.tracef( "#performUpdate(%s)", tableMapping.getTableName() ); - - final TableUpdate tableUpdate; - if ( tableMapping.getUpdateDetails() != null - && tableMapping.getUpdateDetails().getCustomSql() != null ) { - tableUpdate = new TableUpdateCustomSql( - new MutatingTableReference( tableMapping ), - mutationTarget, - "upsert update for " + mutationTarget.getRolePath(), - valueBindings, - keyBindings, - optimisticLockBindings, - parameters - ); - } - else { - tableUpdate = new TableUpdateStandard( - new MutatingTableReference( tableMapping ), - mutationTarget, - "upsert update for " + mutationTarget.getRolePath(), - valueBindings, - keyBindings, - optimisticLockBindings, - parameters - ); - } - - final SqlAstTranslator translator = session - .getJdbcServices() - .getJdbcEnvironment() - .getSqlAstTranslatorFactory() - .buildModelMutationTranslator( tableUpdate, session.getFactory() ); - - final JdbcMutationOperation jdbcUpdate = translator.translate( null, MutationQueryOptions.INSTANCE ); + final JdbcMutationOperation jdbcUpdate = createJdbcUpdate( session ); final PreparedStatementGroupSingleTable statementGroup = new PreparedStatementGroupSingleTable( jdbcUpdate, session ); final PreparedStatementDetails statementDetails = statementGroup.resolvePreparedStatementDetails( tableMapping.getTableName() ); @@ -374,6 +345,44 @@ public class OptionalTableUpdateOperation implements SelfExecutingUpdateOperatio } } + /* + * Used by Hibernate Reactive + */ + protected JdbcMutationOperation createJdbcUpdate(SharedSessionContractImplementor session) { + final TableUpdate tableUpdate; + if ( tableMapping.getUpdateDetails() != null + && tableMapping.getUpdateDetails().getCustomSql() != null ) { + tableUpdate = new TableUpdateCustomSql( + new MutatingTableReference( tableMapping ), + mutationTarget, + "upsert update for " + mutationTarget.getRolePath(), + valueBindings, + keyBindings, + optimisticLockBindings, + parameters + ); + } + else { + tableUpdate = new TableUpdateStandard( + new MutatingTableReference( tableMapping ), + mutationTarget, + "upsert update for " + mutationTarget.getRolePath(), + valueBindings, + keyBindings, + optimisticLockBindings, + parameters + ); + } + + final SqlAstTranslator translator = session + .getJdbcServices() + .getJdbcEnvironment() + .getSqlAstTranslatorFactory() + .buildModelMutationTranslator( tableUpdate, session.getFactory() ); + + return translator.translate( null, MutationQueryOptions.INSTANCE ); + } + private void performInsert(JdbcValueBindings jdbcValueBindings, SharedSessionContractImplementor session) { final JdbcInsertMutation jdbcInsert = createJdbcInsert( session ); @@ -414,7 +423,10 @@ public class OptionalTableUpdateOperation implements SelfExecutingUpdateOperatio } } - private JdbcInsertMutation createJdbcInsert(SharedSessionContractImplementor session) { + /* + * Used by Hibernate Reactive + */ + protected JdbcInsertMutation createJdbcInsert(SharedSessionContractImplementor session) { final TableInsert tableInsert; if ( tableMapping.getInsertDetails() != null && tableMapping.getInsertDetails().getCustomSql() != null ) {