KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > loader > collection > BasicCollectionLoader


1 //$Id: BasicCollectionLoader.java,v 1.1 2005/06/13 20:10:19 oneovthafew Exp $
2
package org.hibernate.loader.collection;
3
4 import java.util.Map JavaDoc;
5
6 import org.apache.commons.logging.Log;
7 import org.apache.commons.logging.LogFactory;
8 import org.hibernate.MappingException;
9 import org.hibernate.engine.SessionFactoryImplementor;
10 import org.hibernate.loader.JoinWalker;
11 import org.hibernate.persister.collection.QueryableCollection;
12
13 /**
14  * Loads a collection of values or a many-to-many association.
15  * <br>
16  * The collection persister must implement <tt>QueryableCOllection<tt>. For
17  * other collections, create a customized subclass of <tt>Loader</tt>.
18  *
19  * @see OneToManyLoader
20  * @author Gavin King
21  */

22 public class BasicCollectionLoader extends CollectionLoader {
23
24     private static final Log log = LogFactory.getLog(BasicCollectionLoader.class);
25
26     public BasicCollectionLoader(
27             QueryableCollection collectionPersister,
28             SessionFactoryImplementor session,
29             Map JavaDoc enabledFilters)
30     throws MappingException {
31         this(collectionPersister, 1, session, enabledFilters);
32     }
33
34     public BasicCollectionLoader(
35             QueryableCollection collectionPersister,
36             int batchSize,
37             SessionFactoryImplementor factory,
38             Map JavaDoc enabledFilters)
39     throws MappingException {
40         this(collectionPersister, batchSize, null, factory, enabledFilters);
41     }
42     
43     protected BasicCollectionLoader(
44             QueryableCollection collectionPersister,
45             int batchSize,
46             String JavaDoc subquery,
47             SessionFactoryImplementor factory,
48             Map JavaDoc enabledFilters)
49     throws MappingException {
50         
51         super(collectionPersister, factory, enabledFilters);
52         
53         JoinWalker walker = new BasicCollectionJoinWalker(
54                 collectionPersister,
55                 batchSize,
56                 subquery,
57                 factory,
58                 enabledFilters
59             );
60         initFromWalker( walker );
61
62         postInstantiate();
63
64         log.debug( "Static select for collection " + collectionPersister.getRole() + ": " + getSQLString() );
65     }
66     
67 }
68
Popular Tags