HHH-18647 Fix insert values check for table group joins

This commit is contained in:
Marco Belladelli 2024-09-25 10:54:32 +02:00
parent d7da2bdd11
commit 0ceada1a18

View File

@ -1271,11 +1271,6 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
this
);
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
}
getFromClauseAccess().registerTableGroup( rootPath, rootTableGroup );
final InsertSelectStatement insertStatement = new InsertSelectStatement(
@ -1291,9 +1286,8 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
rootTableGroup
);
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
throw new SemanticException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
if ( hasJoins( rootTableGroup ) ) {
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
}
for ( SqmValues sqmValues : sqmStatement.getValuesList() ) {