mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 04:34:49 +00:00
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.MutatingTableReference;
|
import org.hibernate.sql.model.ast.MutatingTableReference;
|
||||||
import org.hibernate.sql.model.ast.RestrictedTableMutation;
|
import org.hibernate.sql.model.ast.RestrictedTableMutation;
|
||||||
import org.hibernate.sql.model.ast.TableUpdate;
|
import org.hibernate.sql.model.ast.TableUpdate;
|
||||||
|
import org.hibernate.sql.model.jdbc.OptionalTableUpdateOperation;
|
||||||
|
|
||||||
import static org.hibernate.sql.model.ast.AbstractTableUpdate.collectParameters;
|
import static org.hibernate.sql.model.ast.AbstractTableUpdate.collectParameters;
|
||||||
|
|
||||||
@ -123,9 +124,13 @@ public void accept(SqlAstWalker walker) {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutationOperation createMutationOperation(
|
@Override
|
||||||
ValuesAnalysis valuesAnalysis,
|
public MutationOperation createMutationOperation(ValuesAnalysis valuesAnalysis, SessionFactoryImplementor factory) {
|
||||||
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(
|
return factory.getJdbcServices().getDialect().createUpsertOperation(
|
||||||
getMutationTarget(),
|
getMutationTarget(),
|
||||||
this,
|
this,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user