From a8c6790d729a4a336359a5f60cbb0e00b6937738 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 19 Oct 2016 22:56:52 +0100 Subject: [PATCH] HHH-11182 - HQL subquery with constraint property in superclass does not join superclass table (cherry picked from commit b3151de647542b2aec248a40b23a3d45258551cc) --- .../org/hibernate/hql/internal/ast/util/JoinProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/JoinProcessor.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/JoinProcessor.java index 35cab417be..84ce79e6fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/JoinProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/util/JoinProcessor.java @@ -164,7 +164,9 @@ public class JoinProcessor implements SqlTokenTypes { } // If there is a FROM fragment and the FROM element is an explicit, then add the from part. - if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) { + if ( fromElement.useFromFragment() || + ( fromElement.getFromClause().isSubQuery() + && fromElement.isDereferencedBySuperclassOrSubclassProperty() ) /*&& StringHelper.isNotEmpty( frag )*/ ) { String fromFragment = processFromFragment( frag, join ).trim(); LOG.debugf( "Using FROM fragment [%s]", fromFragment ); processDynamicFilterParameters(