Fix test failure by respecting custom insert/delete SQL for secondary tables
This commit is contained in:
parent
0bb04b1021
commit
a0d162cde8
|
@ -25,6 +25,7 @@ import org.hibernate.sql.model.ast.ColumnValueParameter;
|
|||
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;
|
||||
|
||||
|
@ -123,9 +124,13 @@ public class TableUpsert
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue