public class

JoinWalker

extends Object
java.lang.Object
   ↳ org.hibernate.loader.JoinWalker
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Walks the metamodel, searching for joins, and collecting together information needed by OuterJoinLoader.

See Also

Summary

Nested Classes
interface JoinWalker.AssociationInitCallback  
Fields
protected String[] aliases
protected final 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
Protected Constructors
JoinWalker(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)
Public Methods
String[] getAliases()
int[] getCollectionOwners()
CollectionPersister[] getCollectionPersisters()
String[] getCollectionSuffixes()
LoadQueryInfluencers getLoadQueryInfluencers()
LockMode[] getLockModeArray()
LockOptions getLockModeOptions()
EntityType[] getOwnerAssociationTypes()
int[] getOwners()
Loadable[] getPersisters()
String getSQLString()
String[] getSuffixes()
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 Methods
final 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
final 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
String generateRootAlias(String description)
String generateTableAlias(int n, PropertyPath path, Joinable joinable)
Dialect getDialect()
SessionFactoryImplementor getFactory()
int getJoinType(OuterJoinLoadable persister, PropertyPath 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.
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
int getJoinType(AssociationType associationType, FetchMode config, PropertyPath 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.
String getWithClause(PropertyPath path)
void initPersisters(List associations, LockOptions lockOptions, JoinWalker.AssociationInitCallback callback)
void initPersisters(List associations, LockOptions lockOptions)
void initPersisters(List associations, LockMode lockMode)
boolean isDuplicateAssociation(String lhsTable, String[] lhsColumnNames, AssociationType type)
Used to detect circularities in the joined graph, note that this method is side-effecty
boolean isDuplicateAssociation(String foreignKeyTable, String[] foreignKeyColumns)
Used to detect circularities in the joined graph, note that this method is side-effecty
boolean isJoinable(int joinType, Set visitedAssociationKeys, String lhsTable, String[] lhsColumnNames, AssociationType type, int depth)
Should we join this association?
boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle)
Override on subclasses to enable or suppress joining of certain association types
boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type)
Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining
boolean isTooDeep(int currentDepth)
boolean isTooManyCollections()
static String mergeOrderings(String ordering1, String ordering2)
final JoinFragment mergeOuterJoins(List associations)
Generate a sequence of LEFT OUTER JOIN clauses for the given associations.
String orderBy(List associations, String orderBy)
final static String orderBy(List associations)
Get the order by string required for collection fetching
final String selectString(List associations)
Generate a select list of columns containing all properties of the entity classes
final void walkCollectionTree(QueryableCollection persister, String alias)
For a collection role, return a list of associations to be fetched by outerjoin
final 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.
StringBuffer whereString(String alias, String[] columnNames, int batchSize)
Render the where condition for a (batch) load by identifier / collection key
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected String[] aliases

protected final 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

Protected Constructors

protected JoinWalker (SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)

Public Methods

public String[] getAliases ()

public int[] getCollectionOwners ()

public CollectionPersister[] getCollectionPersisters ()

public String[] getCollectionSuffixes ()

public LoadQueryInfluencers getLoadQueryInfluencers ()

public LockMode[] getLockModeArray ()

public LockOptions getLockModeOptions ()

public EntityType[] getOwnerAssociationTypes ()

public int[] getOwners ()

public Loadable[] getPersisters ()

public String getSQLString ()

public String[] getSuffixes ()

public void setAliases (String[] aliases)

public void setCollectionOwners (int[] collectionOwners)

public void setCollectionPersisters (CollectionPersister[] collectionPersisters)

public void setCollectionSuffixes (String[] collectionSuffixes)

public void setOwnerAssociationTypes (EntityType[] ownerAssociationType)

public void setOwners (int[] owners)

public void setPersisters (Loadable[] persisters)

public void setSql (String sql)

public void setSuffixes (String[] suffixes)

Protected Methods

protected static final 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 final 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, PropertyPath path, Joinable joinable)

protected Dialect getDialect ()

protected SessionFactoryImplementor getFactory ()

protected int getJoinType (OuterJoinLoadable persister, PropertyPath 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.

Parameters
persister The owner of the association.
path The path to the association
propertyNumber 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 table
lhsColumns The owner join columns
nullable Is the association nullable.
currentDepth Current join depth
Returns
Throws
MappingException ??

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 (AssociationType associationType, FetchMode config, PropertyPath 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.

Parameters
associationType The association associationType.
config The metadata-defined fetch mode.
path The path to the association
lhsTable The owner table
lhsColumns The owner join columns
nullable Is the association nullable.
currentDepth Current join depth
cascadeStyle The metadata-defined cascade style.
Returns
Throws
MappingException ??

protected String getWithClause (PropertyPath path)

protected void initPersisters (List associations, LockOptions lockOptions, JoinWalker.AssociationInitCallback callback)

protected void initPersisters (List associations, LockOptions lockOptions)

protected void initPersisters (List associations, LockMode lockMode)

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 isDuplicateAssociation (String foreignKeyTable, String[] foreignKeyColumns)

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 final JoinFragment mergeOuterJoins (List associations)

Generate a sequence of LEFT OUTER JOIN clauses for the given associations.

protected String orderBy (List associations, String orderBy)

protected static final String orderBy (List associations)

Get the order by string required for collection fetching

protected final String selectString (List associations)

Generate a select list of columns containing all properties of the entity classes

protected final void walkCollectionTree (QueryableCollection persister, String alias)

For a collection role, return a list of associations to be fetched by outerjoin

protected final 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. This form is the entry point into the walking for a given entity, starting the recursive calls into #walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath ,int).

Parameters
persister The persister representing the entity to be walked.
alias The (root) alias to use for this entity/persister.
Throws
MappingException ???

protected StringBuffer whereString (String alias, String[] columnNames, int batchSize)

Render the where condition for a (batch) load by identifier / collection key