diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/EntityGraphQueryHint.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/EntityGraphQueryHint.java index f505bea452..6c23324ff6 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/EntityGraphQueryHint.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/EntityGraphQueryHint.java @@ -22,6 +22,7 @@ import org.hibernate.hql.internal.ast.HqlSqlWalker; import org.hibernate.hql.internal.ast.tree.FromClause; import org.hibernate.hql.internal.ast.tree.FromElement; import org.hibernate.hql.internal.ast.tree.FromElementFactory; +import org.hibernate.hql.internal.ast.tree.ImpliedFromElement; import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.sql.JoinType; import org.hibernate.type.CollectionType; @@ -47,7 +48,7 @@ public class EntityGraphQueryHint { Map explicitFetches = new HashMap(); for ( Object o : fromClause.getFromElements() ) { final FromElement fromElement = (FromElement) o; - if ( fromElement.getRole() != null ) { + if ( fromElement.getRole() != null && ! (fromElement instanceof ImpliedFromElement) ) { explicitFetches.put( fromElement.getRole(), fromElement ); } }