diff --git a/entitymanager/src/main/java/org/hibernate/ejb/criteria/path/AbstractFromImpl.java b/entitymanager/src/main/java/org/hibernate/ejb/criteria/path/AbstractFromImpl.java index c4c8af060c..2d2f08960b 100644 --- a/entitymanager/src/main/java/org/hibernate/ejb/criteria/path/AbstractFromImpl.java +++ b/entitymanager/src/main/java/org/hibernate/ejb/criteria/path/AbstractFromImpl.java @@ -24,6 +24,7 @@ package org.hibernate.ejb.criteria.path; import java.io.Serializable; +import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import javax.persistence.criteria.CollectionJoin; @@ -243,8 +244,11 @@ public abstract class AbstractFromImpl /** * {@inheritDoc} */ + @SuppressWarnings({ "unchecked" }) public Set> getJoins() { - return joins; + return joins == null + ? Collections.EMPTY_SET + : joins; } /** @@ -575,8 +579,11 @@ public abstract class AbstractFromImpl /** * {@inheritDoc} */ + @SuppressWarnings({ "unchecked" }) public Set> getFetches() { - return fetches; + return fetches == null + ? Collections.EMPTY_SET + : fetches; } public Fetch fetch(SingularAttribute singularAttribute) {