Skip to content

Commit 0ceada1

Browse files
committed
HHH-18647 Fix insert values check for table group joins
1 parent d7da2bd commit 0ceada1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,11 +1271,6 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
12711271
this
12721272
);
12731273

1274-
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
1275-
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
1276-
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
1277-
}
1278-
12791274
getFromClauseAccess().registerTableGroup( rootPath, rootTableGroup );
12801275

12811276
final InsertSelectStatement insertStatement = new InsertSelectStatement(
@@ -1291,9 +1286,8 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
12911286
rootTableGroup
12921287
);
12931288

1294-
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
1295-
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
1296-
throw new SemanticException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
1289+
if ( hasJoins( rootTableGroup ) ) {
1290+
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
12971291
}
12981292

12991293
for ( SqmValues sqmValues : sqmStatement.getValuesList() ) {

0 commit comments

Comments
 (0)