From 8a0dab90718a97ff08afadbed7df6c4f87f7cb2f Mon Sep 17 00:00:00 2001 From: Marco Belladelli Date: Wed, 25 Sep 2024 10:54:32 +0200 Subject: [PATCH] HHH-18647 Fix insert values check for table group joins --- .../query/sqm/sql/BaseSqmToSqlAstConverter.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 49f6b8dea1..1d7965ac2a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -1280,11 +1280,6 @@ public abstract class BaseSqmToSqlAstConverter extends Base 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( @@ -1300,9 +1295,8 @@ public abstract class BaseSqmToSqlAstConverter extends Base 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() ) {