1 package org.hibernate.loader.collection; 3 4 import java.io.Serializable ; 5 import java.util.Map ; 6 7 import org.hibernate.HibernateException; 8 import org.hibernate.engine.SessionFactoryImplementor; 9 import org.hibernate.engine.SessionImplementor; 10 import org.hibernate.loader.OuterJoinLoader; 11 import org.hibernate.persister.collection.QueryableCollection; 12 import org.hibernate.type.Type; 13 14 21 public class CollectionLoader extends OuterJoinLoader implements CollectionInitializer { 22 23 private final QueryableCollection collectionPersister; 24 25 public CollectionLoader(QueryableCollection collectionPersister, SessionFactoryImplementor factory, Map enabledFilters) { 26 super( factory, enabledFilters ); 27 this.collectionPersister = collectionPersister; 28 } 29 30 protected boolean isSubselectLoadingEnabled() { 31 return hasSubselectLoadableCollections(); 32 } 33 34 public void initialize(Serializable id, SessionImplementor session) 35 throws HibernateException { 36 loadCollection( session, id, getKeyType() ); 37 } 38 39 protected Type getKeyType() { 40 return collectionPersister.getKeyType(); 41 } 42 43 public String toString() { 44 return getClass().getName() + '(' + collectionPersister.getRole() + ')'; 45 } 46 } 47 | Popular Tags |