Skip to content

Commit 5a3296e

Browse files
committed
HHH-18647 Fix insert values check for table group joins
1 parent 71dfffd commit 5a3296e

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
@@ -1279,11 +1279,6 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
12791279
this
12801280
);
12811281

1282-
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
1283-
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
1284-
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
1285-
}
1286-
12871282
getFromClauseAccess().registerTableGroup( rootPath, rootTableGroup );
12881283

12891284
final InsertSelectStatement insertStatement = new InsertSelectStatement(
@@ -1299,9 +1294,8 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
12991294
rootTableGroup
13001295
);
13011296

1302-
if ( !rootTableGroup.getTableReferenceJoins().isEmpty()
1303-
|| !rootTableGroup.getTableGroupJoins().isEmpty() ) {
1304-
throw new SemanticException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
1297+
if ( hasJoins( rootTableGroup ) ) {
1298+
throw new HibernateException( "Not expecting multiple table references for an SQM INSERT-SELECT" );
13051299
}
13061300

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

0 commit comments

Comments
 (0)