站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

OuterJoinLoader (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.loader
Class OuterJoinLoader

java.lang.Object
  extended bynet.sf.hibernate.loader.Loader
      extended bynet.sf.hibernate.loader.OuterJoinLoader
Direct Known Subclasses:
AbstractEntityLoader, CollectionLoader, OneToManyLoader, SQLLoader

public abstract class OuterJoinLoader
extends Loader

Implements logic for walking a tree of associated classes. Generates an SQL select string containing all properties of those classes. Tables are joined using an ANSI-style left outer join.

Author:
Gavin King, Jon Lipsky

Nested Class Summary
static class OuterJoinLoader.OuterJoinableAssociation
           
 
Field Summary
static int AUTO
           
protected  Loadable[] classPersisters
           
static int EAGER
           
static int LAZY
           
protected  LockMode[] lockModeArray
           
protected  int[] owners
           
protected  String sql
           
protected  String[] suffixes
           
 
Fields inherited from class net.sf.hibernate.loader.Loader
NO_SUFFIX
 
Constructor Summary
OuterJoinLoader(Dialect dialect)
           
 
Method Summary
protected static boolean containsCollectionPersister(List associations)
           
protected static int countClassPersisters(List associations)
          Count the number of instances of Joinable which are actually also instances of Loadable, or are one-to-many associations
protected  LockMode[] createLockModeArray(int length, LockMode lockMode)
           
protected  String generateRootAlias(String tableName)
           
protected  String generateTableAlias(String className, int n, String path, boolean isLinkTable)
           
protected  CollectionPersister getCollectionPersister()
          An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
protected  int getJoinType(AssociationType type, int config, String path, String table, String[] foreignKeyColumns, SessionFactoryImplementor factory)
           
protected  LockMode[] getLockModes(Map lockModes)
          What lock mode does this load entities with?
protected  int[] getOwners()
          An array of indexes of the entity that owns a one-to-one association to the entity at the given index (-1 if there is no "owner")
protected  Loadable[] getPersisters()
          An array of persisters of entity classes contained in each row of results; implemented by all subclasses
protected  String getSQLString()
          The SQL query string to be called; implemented by all subclasses
protected  String[] getSuffixes()
          The suffix identifies a particular column of results in the SQL ResultSet; implemented by all subclasses
protected  boolean isJoinedFetchEnabled(Type type, boolean mappingDefault, String path, String table, String[] foreignKeyColumns)
          Override on subclasses to enable or suppress joining of some associations, especially in the case of dynamic fetch settings
protected  boolean isJoinedFetchEnabledByDefault(int config, AssociationType type, SessionFactoryImplementor factory)
          Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining
protected  JoinFragment mergeOuterJoins(List associations)
          Generate a sequence of LEFT OUTER JOIN clauses for the given associations.
protected  String selectString(List associations, SessionFactoryImplementor factory)
          Generate a select list of columns containing all properties of the entity classes
protected  int toOwner(OuterJoinLoader.OuterJoinableAssociation oj, int joins, boolean dontIgnore)
           
protected  List walkCollectionTree(QueryableCollection persister, String alias, SessionFactoryImplementor factory)
          For a collection role, return a list of associations to be fetched by outerjoin
protected  List walkTree(OuterJoinLoadable persister, String alias, SessionFactoryImplementor factory)
          For an entity class, return a list of associations to be fetched by outerjoin
protected static StringBuffer whereString(String alias, String[] columnNames, int batchSize)
          Render the where condition for a (batch) load by identifier / collection key
 
Methods inherited from class net.sf.hibernate.loader.Loader
applyLocks, bindNamedParameters, bindPositionalParameters, doList, generateAlias, generateSuffixes, getCollectionOwner, getResultColumnOrRow, getResultList, getResultSet, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadEntity, loadEntityBatch, loadSingleRow, postInstantiate, prepareQueryStatement, upgradeLocks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EAGER

public static final int EAGER
See Also:
Constant Field Values

AUTO

public static final int AUTO
See Also:
Constant Field Values

LAZY

public static final int LAZY
See Also:
Constant Field Values

classPersisters

protected Loadable[] classPersisters

lockModeArray

protected LockMode[] lockModeArray

owners

protected int[] owners

sql

protected String sql

suffixes

protected String[] suffixes
Constructor Detail

OuterJoinLoader

public OuterJoinLoader(Dialect dialect)
Method Detail

isJoinedFetchEnabled

protected boolean isJoinedFetchEnabled(Type type,
                                       boolean mappingDefault,
                                       String path,
                                       String table,
                                       String[] foreignKeyColumns)
Override on subclasses to enable or suppress joining of some associations, especially in the case of dynamic fetch settings


getJoinType

protected int getJoinType(AssociationType type,
                          int config,
                          String path,
                          String table,
                          String[] foreignKeyColumns,
                          SessionFactoryImplementor factory)
                   throws MappingException
Throws:
MappingException

walkTree

protected final List walkTree(OuterJoinLoadable persister,
                              String alias,
                              SessionFactoryImplementor factory)
                       throws MappingException
For an entity class, return a list of associations to be fetched by outerjoin

Throws:
MappingException

walkCollectionTree

protected final List walkCollectionTree(QueryableCollection persister,
                                        String alias,
                                        SessionFactoryImplementor factory)
                                 throws MappingException
For a collection role, return a list of associations to be fetched by outerjoin

Throws:
MappingException

isJoinedFetchEnabledByDefault

protected boolean isJoinedFetchEnabledByDefault(int config,
                                                AssociationType type,
                                                SessionFactoryImplementor factory)
                                         throws MappingException
Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining

Throws:
MappingException

getSQLString

protected final String getSQLString()
Description copied from class: Loader
The SQL query string to be called; implemented by all subclasses

Specified by:
getSQLString in class Loader

getPersisters

protected final Loadable[] getPersisters()
Description copied from class: Loader
An array of persisters of entity classes contained in each row of results; implemented by all subclasses

Specified by:
getPersisters in class Loader

selectString

protected final String selectString(List associations,
                                    SessionFactoryImplementor factory)
                             throws MappingException
Generate a select list of columns containing all properties of the entity classes

Throws:
MappingException

getSuffixes

protected String[] getSuffixes()
Description copied from class: Loader
The suffix identifies a particular column of results in the SQL ResultSet; implemented by all subclasses

Specified by:
getSuffixes in class Loader

generateTableAlias

protected String generateTableAlias(String className,
                                    int n,
                                    String path,
                                    boolean isLinkTable)

generateRootAlias

protected String generateRootAlias(String tableName)

getCollectionPersister

protected CollectionPersister getCollectionPersister()
Description copied from class: Loader
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value

Specified by:
getCollectionPersister in class Loader

mergeOuterJoins

protected final JoinFragment mergeOuterJoins(List associations)
Generate a sequence of LEFT OUTER JOIN clauses for the given associations.


countClassPersisters

protected static final int countClassPersisters(List associations)
Count the number of instances of Joinable which are actually also instances of Loadable, or are one-to-many associations


containsCollectionPersister

protected static boolean containsCollectionPersister(List associations)

getLockModes

protected LockMode[] getLockModes(Map lockModes)
Description copied from class: Loader
What lock mode does this load entities with?

Specified by:
getLockModes in class Loader
Parameters:
lockModes - a collection of lock modes specified dynamically via the Query interface

createLockModeArray

protected LockMode[] createLockModeArray(int length,
                                         LockMode lockMode)

whereString

protected static StringBuffer whereString(String alias,
                                          String[] columnNames,
                                          int batchSize)
Render the where condition for a (batch) load by identifier / collection key


getOwners

protected int[] getOwners()
Description copied from class: Loader
An array of indexes of the entity that owns a one-to-one association to the entity at the given index (-1 if there is no "owner")

Specified by:
getOwners in class Loader

toOwner

protected int toOwner(OuterJoinLoader.OuterJoinableAssociation oj,
                      int joins,
                      boolean dontIgnore)