|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.loader.JoinWalker
public class JoinWalker
Walks the metamodel, searching for joins, and collecting together information needed by OuterJoinLoader.
OuterJoinLoader
Field Summary | |
---|---|
protected String[] |
aliases
|
protected List |
associations
|
protected int[] |
collectionOwners
|
protected CollectionPersister[] |
collectionPersisters
|
protected String[] |
collectionSuffixes
|
protected LockMode[] |
lockModeArray
|
protected LockOptions |
lockOptions
|
protected EntityType[] |
ownerAssociationTypes
|
protected int[] |
owners
|
protected Loadable[] |
persisters
|
protected String |
sql
|
protected String[] |
suffixes
|
Constructor Summary | |
---|---|
protected |
JoinWalker(SessionFactoryImplementor factory,
LoadQueryInfluencers loadQueryInfluencers)
|
Method Summary | |
---|---|
protected static int |
countCollectionPersisters(List associations)
Count the number of instances of Joinable which are actually also instances of PersistentCollection which are being fetched by outer join |
protected static int |
countEntityPersisters(List associations)
Count the number of instances of Joinable which are actually also instances of Loadable, or are one-to-many associations |
protected String |
generateRootAlias(String description)
|
protected String |
generateTableAlias(int n,
String path,
Joinable joinable)
|
String[] |
getAliases()
|
int[] |
getCollectionOwners()
|
CollectionPersister[] |
getCollectionPersisters()
|
String[] |
getCollectionSuffixes()
|
protected Dialect |
getDialect()
|
protected SessionFactoryImplementor |
getFactory()
|
protected int |
getJoinType(AssociationType associationType,
FetchMode config,
String path,
String lhsTable,
String[] lhsColumns,
boolean nullable,
int currentDepth,
CascadeStyle cascadeStyle)
Determine the appropriate associationType of join (if any) to use to fetch the given association. |
protected int |
getJoinType(boolean nullable,
int currentDepth)
Use an inner join if it is a non-null association and this is the "first" join in a series |
protected int |
getJoinType(OuterJoinLoadable persister,
String path,
int propertyNumber,
AssociationType associationType,
FetchMode metadataFetchMode,
CascadeStyle metadataCascadeStyle,
String lhsTable,
String[] lhsColumns,
boolean nullable,
int currentDepth)
Determine the appropriate type of join (if any) to use to fetch the given association. |
LoadQueryInfluencers |
getLoadQueryInfluencers()
|
LockMode[] |
getLockModeArray()
|
LockOptions |
getLockModeOptions()
|
EntityType[] |
getOwnerAssociationTypes()
|
int[] |
getOwners()
|
Loadable[] |
getPersisters()
|
String |
getSQLString()
|
String[] |
getSuffixes()
|
protected String |
getWithClause(String path)
|
protected void |
initPersisters(List associations,
LockMode lockMode)
|
protected void |
initPersisters(List associations,
LockOptions lockOptions)
|
protected boolean |
isDuplicateAssociation(String foreignKeyTable,
String[] foreignKeyColumns)
Used to detect circularities in the joined graph, note that this method is side-effecty |
protected boolean |
isDuplicateAssociation(String lhsTable,
String[] lhsColumnNames,
AssociationType type)
Used to detect circularities in the joined graph, note that this method is side-effecty |
protected boolean |
isJoinable(int joinType,
Set visitedAssociationKeys,
String lhsTable,
String[] lhsColumnNames,
AssociationType type,
int depth)
Should we join this association? |
protected boolean |
isJoinedFetchEnabled(AssociationType type,
FetchMode config,
CascadeStyle cascadeStyle)
Override on subclasses to enable or suppress joining of certain association types |
protected boolean |
isJoinedFetchEnabledInMapping(FetchMode config,
AssociationType type)
Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining |
protected boolean |
isTooDeep(int currentDepth)
|
protected boolean |
isTooManyCollections()
|
protected static String |
mergeOrderings(String ordering1,
String ordering2)
|
protected JoinFragment |
mergeOuterJoins(List associations)
Generate a sequence of LEFT OUTER JOIN clauses for the given associations. |
protected static String |
orderBy(List associations)
Get the order by string required for collection fetching |
protected String |
orderBy(List associations,
String orderBy)
|
protected String |
selectString(List associations)
Generate a select list of columns containing all properties of the entity classes |
void |
setAliases(String[] aliases)
|
void |
setCollectionOwners(int[] collectionOwners)
|
void |
setCollectionPersisters(CollectionPersister[] collectionPersisters)
|
void |
setCollectionSuffixes(String[] collectionSuffixes)
|
void |
setOwnerAssociationTypes(EntityType[] ownerAssociationType)
|
void |
setOwners(int[] owners)
|
void |
setPersisters(Loadable[] persisters)
|
void |
setSql(String sql)
|
void |
setSuffixes(String[] suffixes)
|
protected void |
walkCollectionTree(QueryableCollection persister,
String alias)
For a collection role, return a list of associations to be fetched by outerjoin |
protected void |
walkEntityTree(OuterJoinLoadable persister,
String alias)
Walk the association tree for an entity, adding associations which should be join fetched to the associations inst var. |
protected StringBuffer |
whereString(String alias,
String[] columnNames,
int batchSize)
Render the where condition for a (batch) load by identifier / collection key |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List associations
protected String[] suffixes
protected String[] collectionSuffixes
protected Loadable[] persisters
protected int[] owners
protected EntityType[] ownerAssociationTypes
protected CollectionPersister[] collectionPersisters
protected int[] collectionOwners
protected String[] aliases
protected LockOptions lockOptions
protected LockMode[] lockModeArray
protected String sql
Constructor Detail |
---|
protected JoinWalker(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)
Method Detail |
---|
public String[] getCollectionSuffixes()
public void setCollectionSuffixes(String[] collectionSuffixes)
public LockOptions getLockModeOptions()
public LockMode[] getLockModeArray()
public String[] getSuffixes()
public void setSuffixes(String[] suffixes)
public String[] getAliases()
public void setAliases(String[] aliases)
public int[] getCollectionOwners()
public void setCollectionOwners(int[] collectionOwners)
public CollectionPersister[] getCollectionPersisters()
public void setCollectionPersisters(CollectionPersister[] collectionPersisters)
public EntityType[] getOwnerAssociationTypes()
public void setOwnerAssociationTypes(EntityType[] ownerAssociationType)
public int[] getOwners()
public void setOwners(int[] owners)
public Loadable[] getPersisters()
public void setPersisters(Loadable[] persisters)
public String getSQLString()
public void setSql(String sql)
protected SessionFactoryImplementor getFactory()
protected Dialect getDialect()
public LoadQueryInfluencers getLoadQueryInfluencers()
protected String getWithClause(String path)
protected final void walkEntityTree(OuterJoinLoadable persister, String alias) throws MappingException
associations
inst var. This form is the
entry point into the walking for a given entity, starting the recursive
calls into walkEntityTree(OuterJoinLoadable, String, String, int)
.
persister
- The persister representing the entity to be walked.alias
- The (root) alias to use for this entity/persister.
MappingException
- ???protected final void walkCollectionTree(QueryableCollection persister, String alias) throws MappingException
MappingException
protected int getJoinType(OuterJoinLoadable persister, String path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException
persister
- The owner of the association.path
- The path to the associationpropertyNumber
- The property number representing the association.associationType
- The association type.metadataFetchMode
- The metadata-defined fetch mode.metadataCascadeStyle
- The metadata-defined cascade style.lhsTable
- The owner tablelhsColumns
- The owner join columnsnullable
- Is the association nullable.currentDepth
- Current join depth
JoinFragment.INNER_JOIN
,
JoinFragment.LEFT_OUTER_JOIN
, or -1 to indicate no joining.
MappingException
- ??protected int getJoinType(AssociationType associationType, FetchMode config, String path, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth, CascadeStyle cascadeStyle) throws MappingException
associationType
- The association associationType.config
- The metadata-defined fetch mode.path
- The path to the associationlhsTable
- The owner tablelhsColumns
- The owner join columnsnullable
- Is the association nullable.currentDepth
- Current join depthcascadeStyle
- The metadata-defined cascade style.
JoinFragment.INNER_JOIN
,
JoinFragment.LEFT_OUTER_JOIN
, or -1 to indicate no joining.
MappingException
- ??protected int getJoinType(boolean nullable, int currentDepth)
protected boolean isTooDeep(int currentDepth)
protected boolean isTooManyCollections()
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) throws MappingException
MappingException
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle)
protected String generateTableAlias(int n, String path, Joinable joinable)
protected String generateRootAlias(String description)
protected boolean isDuplicateAssociation(String foreignKeyTable, String[] foreignKeyColumns)
protected boolean isDuplicateAssociation(String lhsTable, String[] lhsColumnNames, AssociationType type)
protected boolean isJoinable(int joinType, Set visitedAssociationKeys, String lhsTable, String[] lhsColumnNames, AssociationType type, int depth)
protected String orderBy(List associations, String orderBy)
protected static String mergeOrderings(String ordering1, String ordering2)
protected final JoinFragment mergeOuterJoins(List associations) throws MappingException
MappingException
protected static final int countEntityPersisters(List associations) throws MappingException
MappingException
protected static final int countCollectionPersisters(List associations) throws MappingException
MappingException
protected static final String orderBy(List associations) throws MappingException
MappingException
protected StringBuffer whereString(String alias, String[] columnNames, int batchSize)
protected void initPersisters(List associations, LockMode lockMode) throws MappingException
MappingException
protected void initPersisters(List associations, LockOptions lockOptions) throws MappingException
MappingException
protected final String selectString(List associations) throws MappingException
MappingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |