Skip to content

Commit 8a0dab9

Browse files
committed
HHH-18647 Fix insert values check for table group joins
1 parent 91b1862 commit 8a0dab9

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

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

12901285
final InsertSelectStatement insertStatement = new InsertSelectStatement(
@@ -1300,9 +1295,8 @@ public InsertStatement visitInsertValuesStatement(SqmInsertValuesStatement<?> sq
13001295
rootTableGroup
13011296
);
13021297

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

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

0 commit comments

Comments
 (0)