Skip to content

Commit

Permalink
Fix test failure by respecting custom insert/delete SQL for secondary…
Browse files Browse the repository at this point in the history
… tables
  • Loading branch information
beikov committed Jan 25, 2023
1 parent 0bb04b1 commit a0d162c
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.hibernate.sql.model.ast.MutatingTableReference;
import org.hibernate.sql.model.ast.RestrictedTableMutation;
import org.hibernate.sql.model.ast.TableUpdate;
import org.hibernate.sql.model.jdbc.OptionalTableUpdateOperation;

import static org.hibernate.sql.model.ast.AbstractTableUpdate.collectParameters;

Expand Down Expand Up @@ -123,9 +124,13 @@ public void accept(SqlAstWalker walker) {
throw new UnsupportedOperationException();
}

public MutationOperation createMutationOperation(
ValuesAnalysis valuesAnalysis,
SessionFactoryImplementor factory) {
@Override
public MutationOperation createMutationOperation(ValuesAnalysis valuesAnalysis, SessionFactoryImplementor factory) {
if ( getMutatingTable().getTableMapping().getInsertDetails().getCustomSql() != null
|| getMutatingTable().getTableMapping().getDeleteDetails().getCustomSql() != null ) {
// Fallback to the optional table mutation operation because we have to execute user specified SQL
return new OptionalTableUpdateOperation( getMutationTarget(), this, factory );
}
return factory.getJdbcServices().getDialect().createUpsertOperation(
getMutationTarget(),
this,
Expand Down

0 comments on commit a0d162c

Please sign in to comment.