KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > loader > OuterJoinLoader


1 //$Id: OuterJoinLoader.java,v 1.48 2005/06/13 20:27:15 oneovthafew Exp $
2
package org.hibernate.loader;
3
4 import java.util.Map JavaDoc;
5
6 import org.hibernate.LockMode;
7 import org.hibernate.dialect.Dialect;
8 import org.hibernate.engine.SessionFactoryImplementor;
9 import org.hibernate.persister.collection.CollectionPersister;
10 import org.hibernate.persister.entity.Loadable;
11 import org.hibernate.type.EntityType;
12
13 /**
14  * Implements logic for walking a tree of associated classes.
15  *
16  * Generates an SQL select string containing all properties of those classes.
17  * Tables are joined using an ANSI-style left outer join.
18  *
19  * @author Gavin King
20  */

21 public abstract class OuterJoinLoader extends BasicLoader {
22
23     protected Loadable[] persisters;
24     protected CollectionPersister[] collectionPersisters;
25     protected int[] collectionOwners;
26     protected String JavaDoc[] aliases;
27     protected LockMode[] lockModeArray;
28     protected int[] owners;
29     protected EntityType[] ownerAssociationTypes;
30     protected String JavaDoc sql;
31     protected String JavaDoc[] suffixes;
32     protected String JavaDoc[] collectionSuffixes;
33
34     private Map JavaDoc enabledFilters;
35     
36     protected final Dialect getDialect() {
37         return getFactory().getDialect();
38     }
39
40     public OuterJoinLoader(SessionFactoryImplementor factory, Map JavaDoc enabledFilters) {
41         super(factory);
42         this.enabledFilters = enabledFilters;
43     }
44
45     protected String JavaDoc[] getSuffixes() {
46         return suffixes;
47     }
48
49     protected String JavaDoc[] getCollectionSuffixes() {
50         return collectionSuffixes;
51     }
52
53     protected final String JavaDoc getSQLString() {
54         return sql;
55     }
56
57     protected final Loadable[] getEntityPersisters() {
58         return persisters;
59     }
60
61     protected int[] getOwners() {
62         return owners;
63     }
64
65     protected EntityType[] getOwnerAssociationTypes() {
66         return ownerAssociationTypes;
67     }
68
69     protected LockMode[] getLockModes(Map JavaDoc lockModes) {
70         return lockModeArray;
71     }
72     
73     public Map JavaDoc getEnabledFilters() {
74         return enabledFilters;
75     }
76
77     protected final String JavaDoc[] getAliases() {
78         return aliases;
79     }
80
81     protected final CollectionPersister[] getCollectionPersisters() {
82         return collectionPersisters;
83     }
84
85     protected final int[] getCollectionOwners() {
86         return collectionOwners;
87     }
88
89     protected void initFromWalker(JoinWalker walker) {
90         persisters = walker.getPersisters();
91         collectionPersisters = walker.getCollectionPersisters();
92         ownerAssociationTypes = walker.getOwnerAssociationTypes();
93         lockModeArray = walker.getLockModeArray();
94         suffixes = walker.getSuffixes();
95         collectionSuffixes = walker.getCollectionSuffixes();
96         owners = walker.getOwners();
97         collectionOwners = walker.getCollectionOwners();
98         sql = walker.getSQLString();
99         aliases = walker.getAliases();
100     }
101
102 }
103
Popular Tags