Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.loader
Class Loader  view Loader download Loader.java

java.lang.Object
  extended byorg.hibernate.loader.Loader
Direct Known Subclasses:
BasicLoader

public abstract class Loader
extends java.lang.Object

Abstract superclass of object loading (and querying) strategies. This class implements useful common functionality that concrete loaders delegate to. It is not intended that this functionality would be directly accessed by client code. (Hence, all methods of this class are declared protected or private.) This class relies heavily upon the Loadable interface, which is the contract between this class and EntityPersisters that may be loaded by it.

The present implementation is able to load any number of columns of entities and at most one collection role per query.


Field Summary
private  org.hibernate.jdbc.ColumnNameCache columnNameCache
           
private  org.hibernate.engine.SessionFactoryImplementor factory
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
Loader(org.hibernate.engine.SessionFactoryImplementor factory)
           
 
Method Summary
private  void advance(java.sql.ResultSet rs, org.hibernate.engine.RowSelection selection)
          Advance the cursor to the first required row of the ResultSet
protected  java.lang.String applyLocks(java.lang.String sql, java.util.Map lockModes, org.hibernate.dialect.Dialect dialect)
          Append FOR UPDATE OF clause, if necessary.
protected  void autoDiscoverTypes(java.sql.ResultSet rs)
           
private  int bindLimitParameters(java.sql.PreparedStatement st, int index, org.hibernate.engine.RowSelection selection)
          Bind parameters needed by the dialect-specific LIMIT clause
protected  int bindNamedParameters(java.sql.PreparedStatement ps, java.util.Map namedParams, int start, org.hibernate.engine.SessionImplementor session)
          Bind named parameters to the PreparedStatement.
protected  int bindPositionalParameters(java.sql.PreparedStatement st, org.hibernate.engine.QueryParameters queryParameters, int start, org.hibernate.engine.SessionImplementor session)
          Bind positional parameter values to the PreparedStatement (these are parameters specified by a JDBC-style ?).
private  java.util.Map buildNamedParameterLocMap(org.hibernate.engine.QueryParameters queryParameters)
           
protected  void checkScrollability()
          Check whether the current loader can support returning ScrollableResults.
private  void checkVersion(int i, org.hibernate.persister.entity.Loadable persister, java.io.Serializable id, java.lang.Object entity, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
          Check the version of the object in the ResultSet against the object version in the session cache, throwing an exception if the version numbers are different
private  void createSubselects(java.util.List keys, org.hibernate.engine.QueryParameters queryParameters, org.hibernate.engine.SessionImplementor session)
           
protected  java.util.List doList(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters)
          Actually execute a query, ignoring the query cache
private  java.util.List doQuery(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies)
           
private  java.util.List doQueryAndInitializeNonLazyCollections(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies)
          Execute an SQL query and attempt to instantiate instances of the class mapped by the given persister from each row of the ResultSet.
private  void endCollectionLoad(java.lang.Object resultSetId, org.hibernate.engine.SessionImplementor session, org.hibernate.persister.collection.CollectionPersister collectionPersister)
           
protected  java.lang.String[] getAliases()
          Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading
protected abstract  CollectionAliases[] getCollectionAliases()
           
protected  int[] getCollectionOwners()
          Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie.
protected  org.hibernate.persister.collection.CollectionPersister[] getCollectionPersisters()
          An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
protected abstract  EntityAliases[] getEntityAliases()
          Get the result set descriptor
protected  boolean[] getEntityEagerPropertyFetches()
          An array indicating whether the entities have eager property fetching enabled
protected abstract  org.hibernate.persister.entity.Loadable[] getEntityPersisters()
          An array of persisters of entity classes contained in each row of results; implemented by all subclasses
 org.hibernate.engine.SessionFactoryImplementor getFactory()
           
private static int getFirstRow(org.hibernate.engine.RowSelection selection)
           
private  java.lang.String getInstanceClass(java.sql.ResultSet rs, int i, org.hibernate.persister.entity.Loadable persister, java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Determine the concrete class of an instance in the ResultSet
private  org.hibernate.engine.EntityKey getKeyFromResultSet(int i, org.hibernate.persister.entity.Loadable persister, java.io.Serializable id, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
          Read a row of Keys from the ResultSet into the given array.
protected abstract  org.hibernate.LockMode[] getLockModes(java.util.Map lockModes)
          What lock mode does this load entities with?
private static int getMaxOrLimit(org.hibernate.engine.RowSelection selection, org.hibernate.dialect.Dialect dialect)
          Some dialect-specific LIMIT clauses require the maximium last row number, others require the maximum returned row count.
 int[] getNamedParameterLocs(java.lang.String name)
           
private static org.hibernate.engine.EntityKey getOptionalObjectKey(org.hibernate.engine.QueryParameters queryParameters, org.hibernate.engine.SessionImplementor session)
           
protected  org.hibernate.type.EntityType[] getOwnerAssociationTypes()
          An array of unique key property names by which the corresponding entities are referenced by other entities in the result set
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  java.lang.String getQueryIdentifier()
          Identifies the query for statistics reporting, if null, no statistics will be reported
protected  java.lang.Object getResultColumnOrRow(java.lang.Object[] row, org.hibernate.transform.ResultTransformer transformer, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
          Get the actual object that is returned in the user-visible result list.
private  java.util.List getResultFromQueryCache(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, java.util.Set querySpaces, org.hibernate.type.Type[] resultTypes, org.hibernate.cache.QueryCache queryCache, org.hibernate.cache.QueryKey key)
           
protected  java.util.List getResultList(java.util.List results, org.hibernate.transform.ResultTransformer resultTransformer)
           
protected  java.sql.ResultSet getResultSet(java.sql.PreparedStatement st, boolean autodiscovertypes, boolean callable, org.hibernate.engine.RowSelection selection, org.hibernate.engine.SessionImplementor session)
          Fetch a PreparedStatement, call setMaxRows and then execute it, advance to the first result and return an SQL ResultSet
private  java.lang.Object[] getRow(java.sql.ResultSet rs, org.hibernate.persister.entity.Loadable[] persisters, org.hibernate.engine.EntityKey[] keys, java.lang.Object optionalObject, org.hibernate.engine.EntityKey optionalObjectKey, org.hibernate.LockMode[] lockModes, java.util.List hydratedObjects, org.hibernate.engine.SessionImplementor session)
          Resolve any ids for currently loaded objects, duplications within the ResultSet, etc.
private  java.lang.Object getRowFromResultSet(java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, org.hibernate.LockMode[] lockModeArray, org.hibernate.engine.EntityKey optionalObjectKey, java.util.List hydratedObjects, org.hibernate.engine.EntityKey[] keys, boolean returnProxies)
           
protected abstract  java.lang.String getSQLString()
          The SQL query string to be called; implemented by all subclasses
private  void handleEmptyCollections(java.io.Serializable[] keys, java.lang.Object resultSetId, org.hibernate.engine.SessionImplementor session)
          If this is a collection initializer, we need to tell the session that a collection is being initilized, to account for the possibility of the collection having no elements (hence no rows in the result set).
private static boolean hasMaxRows(org.hibernate.engine.RowSelection selection)
           
protected  boolean hasSubselectLoadableCollections()
           
private  void initializeEntitiesAndCollections(java.util.List hydratedObjects, java.lang.Object resultSetId, org.hibernate.engine.SessionImplementor session, boolean readOnly)
           
private  void instanceAlreadyLoaded(java.sql.ResultSet rs, int i, org.hibernate.persister.entity.Loadable persister, org.hibernate.engine.EntityKey key, java.lang.Object object, org.hibernate.LockMode lockMode, org.hibernate.engine.SessionImplementor session)
          The entity instance is already in the session cache
private  java.lang.Object instanceNotYetLoaded(java.sql.ResultSet rs, int i, org.hibernate.persister.entity.Loadable persister, java.lang.String rowIdAlias, org.hibernate.engine.EntityKey key, org.hibernate.LockMode lockMode, org.hibernate.engine.EntityKey optionalObjectKey, java.lang.Object optionalObject, java.util.List hydratedObjects, org.hibernate.engine.SessionImplementor session)
          The entity instance is not in the session cache
private  boolean isEagerPropertyFetchEnabled(int i)
           
protected  boolean isSingleRowLoader()
          Return false is this loader is a batch entity loader
protected  boolean isSubselectLoadingEnabled()
           
protected  java.util.List list(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, java.util.Set querySpaces, org.hibernate.type.Type[] resultTypes)
          Return the query results, using the query cache, called by subclasses that implement cacheable queries
private  java.util.List listIgnoreQueryCache(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters)
           
private  java.util.List listUsingQueryCache(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, java.util.Set querySpaces, org.hibernate.type.Type[] resultTypes)
           
 void loadCollection(org.hibernate.engine.SessionImplementor session, java.io.Serializable id, org.hibernate.type.Type type)
          Called by subclasses that initialize collections
 void loadCollectionBatch(org.hibernate.engine.SessionImplementor session, java.io.Serializable[] ids, org.hibernate.type.Type type)
          Called by wrappers that batch initialize collections
protected  void loadCollectionSubselect(org.hibernate.engine.SessionImplementor session, java.io.Serializable[] ids, java.lang.Object[] parameterValues, org.hibernate.type.Type[] parameterTypes, java.util.Map namedParameters, org.hibernate.type.Type type)
          Called by subclasses that batch initialize collections
protected  java.util.List loadEntity(org.hibernate.engine.SessionImplementor session, java.lang.Object key, java.lang.Object index, org.hibernate.type.Type keyType, org.hibernate.type.Type indexType, org.hibernate.persister.entity.EntityPersister persister)
          Called by subclasses that load entities
protected  java.util.List loadEntity(org.hibernate.engine.SessionImplementor session, java.lang.Object id, org.hibernate.type.Type identifierType, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalIdentifier, org.hibernate.persister.entity.EntityPersister persister)
          Called by subclasses that load entities
 java.util.List loadEntityBatch(org.hibernate.engine.SessionImplementor session, java.io.Serializable[] ids, org.hibernate.type.Type idType, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalId, org.hibernate.persister.entity.EntityPersister persister)
          Called by wrappers that batch load entities
private  void loadFromResultSet(java.sql.ResultSet rs, int i, java.lang.Object object, java.lang.String instanceEntityName, org.hibernate.engine.EntityKey key, java.lang.String rowIdAlias, org.hibernate.LockMode lockMode, org.hibernate.persister.entity.Loadable rootPersister, org.hibernate.engine.SessionImplementor session)
          Hydrate the state an object from the SQL ResultSet, into an array or "hydrated" values (do not resolve associations yet), and pass the hydrates state to the session.
 java.lang.Object loadSequentialRowsForward(java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies)
          Loads a single logical row from the result set moving forward.
 java.lang.Object loadSequentialRowsReverse(java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies, boolean isLogicallyAfterLast)
          Loads a single logical row from the result set moving forward.
 java.lang.Object loadSingleRow(java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies)
          Loads a single row from the result set.
protected  boolean needsFetchingScroll()
          Does the result set to be scrolled contain collection fetches?
protected  void postInstantiate()
          Calculate and cache select-clause suffixes.
protected  java.sql.PreparedStatement prepareQueryStatement(org.hibernate.engine.QueryParameters queryParameters, boolean scroll, org.hibernate.engine.SessionImplementor session)
          Obtain a PreparedStatement with all parameters pre-bound.
private  java.lang.String prependComment(java.lang.String sql, org.hibernate.engine.QueryParameters parameters)
           
protected  java.lang.String preprocessSQL(java.lang.String sql, org.hibernate.engine.QueryParameters parameters, org.hibernate.dialect.Dialect dialect)
          Modify the SQL, adding lock hints and comments, if necessary
private  void putResultInQueryCache(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, org.hibernate.type.Type[] resultTypes, org.hibernate.cache.QueryCache queryCache, org.hibernate.cache.QueryKey key, java.util.List result)
           
private  void readCollectionElement(java.lang.Object optionalOwner, java.io.Serializable optionalKey, org.hibernate.persister.collection.CollectionPersister persister, CollectionAliases descriptor, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
          Read one collection element from the current row of the JDBC result set
private  void readCollectionElements(java.lang.Object[] row, java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session)
          Read any collection elements contained in a single row of the result set
private  void registerNonExists(org.hibernate.engine.EntityKey[] keys, org.hibernate.persister.entity.Loadable[] persisters, org.hibernate.engine.SessionImplementor session)
          For missing objects associated by one-to-one with another object in the result set, register the fact that the the object is missing with the session.
private  org.hibernate.jdbc.ColumnNameCache retreiveColumnNameToIndexCache(java.sql.ResultSet rs)
           
protected  org.hibernate.ScrollableResults scroll(org.hibernate.engine.QueryParameters queryParameters, org.hibernate.type.Type[] returnTypes, org.hibernate.hql.HolderInstantiator holderInstantiator, org.hibernate.engine.SessionImplementor session)
          Return the query results, as an instance of ScrollableResults
private  java.lang.Object sequentialLoad(java.sql.ResultSet resultSet, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters, boolean returnProxies, org.hibernate.engine.EntityKey keyToRead)
           
private  void setMaxRows(java.sql.PreparedStatement st, org.hibernate.engine.RowSelection selection)
          Use JDBC API to limit the number of rows returned by the SQL query if necessary
 java.lang.String toString()
          Convert this Object to a human-readable String.
private static java.util.Set[] transpose(java.util.List keys)
           
protected  boolean upgradeLocks()
          Does this query return objects that might be already cached by the session, whose lock mode may need upgrading
private static boolean useLimit(org.hibernate.engine.RowSelection selection, org.hibernate.dialect.Dialect dialect)
          Should we pre-process the SQL string, adding a dialect-specific LIMIT clause.
private  java.sql.ResultSet wrapResultSetIfEnabled(java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

factory

private final org.hibernate.engine.SessionFactoryImplementor factory

columnNameCache

private org.hibernate.jdbc.ColumnNameCache columnNameCache
Constructor Detail

Loader

public Loader(org.hibernate.engine.SessionFactoryImplementor factory)
Method Detail

getSQLString

protected abstract java.lang.String getSQLString()
The SQL query string to be called; implemented by all subclasses


getEntityPersisters

protected abstract org.hibernate.persister.entity.Loadable[] getEntityPersisters()
An array of persisters of entity classes contained in each row of results; implemented by all subclasses


getEntityEagerPropertyFetches

protected boolean[] getEntityEagerPropertyFetches()
An array indicating whether the entities have eager property fetching enabled


getOwners

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")


getOwnerAssociationTypes

protected org.hibernate.type.EntityType[] getOwnerAssociationTypes()
An array of unique key property names by which the corresponding entities are referenced by other entities in the result set


getCollectionPersisters

protected org.hibernate.persister.collection.CollectionPersister[] getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value


getCollectionOwners

protected int[] getCollectionOwners()
Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie. in the case of a collection initializer) or no collection.


getLockModes

protected abstract org.hibernate.LockMode[] getLockModes(java.util.Map lockModes)
What lock mode does this load entities with?


applyLocks

protected java.lang.String applyLocks(java.lang.String sql,
                                      java.util.Map lockModes,
                                      org.hibernate.dialect.Dialect dialect)
                               throws org.hibernate.HibernateException
Append FOR UPDATE OF clause, if necessary. This empty superclass implementation merely returns its first argument.


upgradeLocks

protected boolean upgradeLocks()
Does this query return objects that might be already cached by the session, whose lock mode may need upgrading


isSingleRowLoader

protected boolean isSingleRowLoader()
Return false is this loader is a batch entity loader


getAliases

protected java.lang.String[] getAliases()
Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading


preprocessSQL

protected java.lang.String preprocessSQL(java.lang.String sql,
                                         org.hibernate.engine.QueryParameters parameters,
                                         org.hibernate.dialect.Dialect dialect)
                                  throws org.hibernate.HibernateException
Modify the SQL, adding lock hints and comments, if necessary


prependComment

private java.lang.String prependComment(java.lang.String sql,
                                        org.hibernate.engine.QueryParameters parameters)

doQueryAndInitializeNonLazyCollections

private java.util.List doQueryAndInitializeNonLazyCollections(org.hibernate.engine.SessionImplementor session,
                                                              org.hibernate.engine.QueryParameters queryParameters,
                                                              boolean returnProxies)
                                                       throws org.hibernate.HibernateException,
                                                              java.sql.SQLException
Execute an SQL query and attempt to instantiate instances of the class mapped by the given persister from each row of the ResultSet. If an object is supplied, will attempt to initialize that object. If a collection is supplied, attempt to initialize that collection.


loadSingleRow

public java.lang.Object loadSingleRow(java.sql.ResultSet resultSet,
                                      org.hibernate.engine.SessionImplementor session,
                                      org.hibernate.engine.QueryParameters queryParameters,
                                      boolean returnProxies)
                               throws org.hibernate.HibernateException
Loads a single row from the result set. This is the processing used from the ScrollableResults where no collection fetches were encountered.


sequentialLoad

private java.lang.Object sequentialLoad(java.sql.ResultSet resultSet,
                                        org.hibernate.engine.SessionImplementor session,
                                        org.hibernate.engine.QueryParameters queryParameters,
                                        boolean returnProxies,
                                        org.hibernate.engine.EntityKey keyToRead)
                                 throws org.hibernate.HibernateException

loadSequentialRowsForward

public java.lang.Object loadSequentialRowsForward(java.sql.ResultSet resultSet,
                                                  org.hibernate.engine.SessionImplementor session,
                                                  org.hibernate.engine.QueryParameters queryParameters,
                                                  boolean returnProxies)
                                           throws org.hibernate.HibernateException
Loads a single logical row from the result set moving forward. This is the processing used from the ScrollableResults where there were collection fetches encountered; thus a single logical row may have multiple rows in the underlying result set.


loadSequentialRowsReverse

public java.lang.Object loadSequentialRowsReverse(java.sql.ResultSet resultSet,
                                                  org.hibernate.engine.SessionImplementor session,
                                                  org.hibernate.engine.QueryParameters queryParameters,
                                                  boolean returnProxies,
                                                  boolean isLogicallyAfterLast)
                                           throws org.hibernate.HibernateException
Loads a single logical row from the result set moving forward. This is the processing used from the ScrollableResults where there were collection fetches encountered; thus a single logical row may have multiple rows in the underlying result set.


getOptionalObjectKey

private static org.hibernate.engine.EntityKey getOptionalObjectKey(org.hibernate.engine.QueryParameters queryParameters,
                                                                   org.hibernate.engine.SessionImplementor session)

getRowFromResultSet

private java.lang.Object getRowFromResultSet(java.sql.ResultSet resultSet,
                                             org.hibernate.engine.SessionImplementor session,
                                             org.hibernate.engine.QueryParameters queryParameters,
                                             org.hibernate.LockMode[] lockModeArray,
                                             org.hibernate.engine.EntityKey optionalObjectKey,
                                             java.util.List hydratedObjects,
                                             org.hibernate.engine.EntityKey[] keys,
                                             boolean returnProxies)
                                      throws java.sql.SQLException,
                                             org.hibernate.HibernateException

readCollectionElements

private void readCollectionElements(java.lang.Object[] row,
                                    java.sql.ResultSet resultSet,
                                    org.hibernate.engine.SessionImplementor session)
                             throws java.sql.SQLException,
                                    org.hibernate.HibernateException
Read any collection elements contained in a single row of the result set


doQuery

private java.util.List doQuery(org.hibernate.engine.SessionImplementor session,
                               org.hibernate.engine.QueryParameters queryParameters,
                               boolean returnProxies)
                        throws java.sql.SQLException,
                               org.hibernate.HibernateException

isSubselectLoadingEnabled

protected boolean isSubselectLoadingEnabled()

hasSubselectLoadableCollections

protected boolean hasSubselectLoadableCollections()

transpose

private static java.util.Set[] transpose(java.util.List keys)

createSubselects

private void createSubselects(java.util.List keys,
                              org.hibernate.engine.QueryParameters queryParameters,
                              org.hibernate.engine.SessionImplementor session)

buildNamedParameterLocMap

private java.util.Map buildNamedParameterLocMap(org.hibernate.engine.QueryParameters queryParameters)

initializeEntitiesAndCollections

private void initializeEntitiesAndCollections(java.util.List hydratedObjects,
                                              java.lang.Object resultSetId,
                                              org.hibernate.engine.SessionImplementor session,
                                              boolean readOnly)
                                       throws org.hibernate.HibernateException

endCollectionLoad

private void endCollectionLoad(java.lang.Object resultSetId,
                               org.hibernate.engine.SessionImplementor session,
                               org.hibernate.persister.collection.CollectionPersister collectionPersister)

getResultList

protected java.util.List getResultList(java.util.List results,
                                       org.hibernate.transform.ResultTransformer resultTransformer)
                                throws org.hibernate.QueryException

getResultColumnOrRow

protected java.lang.Object getResultColumnOrRow(java.lang.Object[] row,
                                                org.hibernate.transform.ResultTransformer transformer,
                                                java.sql.ResultSet rs,
                                                org.hibernate.engine.SessionImplementor session)
                                         throws java.sql.SQLException,
                                                org.hibernate.HibernateException
Get the actual object that is returned in the user-visible result list. This empty implementation merely returns its first argument. This is overridden by some subclasses.


registerNonExists

private void registerNonExists(org.hibernate.engine.EntityKey[] keys,
                               org.hibernate.persister.entity.Loadable[] persisters,
                               org.hibernate.engine.SessionImplementor session)
For missing objects associated by one-to-one with another object in the result set, register the fact that the the object is missing with the session.


readCollectionElement

private void readCollectionElement(java.lang.Object optionalOwner,
                                   java.io.Serializable optionalKey,
                                   org.hibernate.persister.collection.CollectionPersister persister,
                                   CollectionAliases descriptor,
                                   java.sql.ResultSet rs,
                                   org.hibernate.engine.SessionImplementor session)
                            throws org.hibernate.HibernateException,
                                   java.sql.SQLException
Read one collection element from the current row of the JDBC result set


handleEmptyCollections

private void handleEmptyCollections(java.io.Serializable[] keys,
                                    java.lang.Object resultSetId,
                                    org.hibernate.engine.SessionImplementor session)
                             throws org.hibernate.HibernateException
If this is a collection initializer, we need to tell the session that a collection is being initilized, to account for the possibility of the collection having no elements (hence no rows in the result set).


getKeyFromResultSet

private org.hibernate.engine.EntityKey getKeyFromResultSet(int i,
                                                           org.hibernate.persister.entity.Loadable persister,
                                                           java.io.Serializable id,
                                                           java.sql.ResultSet rs,
                                                           org.hibernate.engine.SessionImplementor session)
                                                    throws org.hibernate.HibernateException,
                                                           java.sql.SQLException
Read a row of Keys from the ResultSet into the given array. Warning: this method is side-effecty.

If an id is given, don't bother going to the ResultSet.


checkVersion

private void checkVersion(int i,
                          org.hibernate.persister.entity.Loadable persister,
                          java.io.Serializable id,
                          java.lang.Object entity,
                          java.sql.ResultSet rs,
                          org.hibernate.engine.SessionImplementor session)
                   throws org.hibernate.HibernateException,
                          java.sql.SQLException
Check the version of the object in the ResultSet against the object version in the session cache, throwing an exception if the version numbers are different


getRow

private java.lang.Object[] getRow(java.sql.ResultSet rs,
                                  org.hibernate.persister.entity.Loadable[] persisters,
                                  org.hibernate.engine.EntityKey[] keys,
                                  java.lang.Object optionalObject,
                                  org.hibernate.engine.EntityKey optionalObjectKey,
                                  org.hibernate.LockMode[] lockModes,
                                  java.util.List hydratedObjects,
                                  org.hibernate.engine.SessionImplementor session)
                           throws org.hibernate.HibernateException,
                                  java.sql.SQLException
Resolve any ids for currently loaded objects, duplications within the ResultSet, etc. Instantiate empty objects to be initialized from the ResultSet. Return an array of objects (a row of results) and an array of booleans (by side-effect) that determine whether the corresponding object should be initialized.


instanceAlreadyLoaded

private void instanceAlreadyLoaded(java.sql.ResultSet rs,
                                   int i,
                                   org.hibernate.persister.entity.Loadable persister,
                                   org.hibernate.engine.EntityKey key,
                                   java.lang.Object object,
                                   org.hibernate.LockMode lockMode,
                                   org.hibernate.engine.SessionImplementor session)
                            throws org.hibernate.HibernateException,
                                   java.sql.SQLException
The entity instance is already in the session cache


instanceNotYetLoaded

private java.lang.Object instanceNotYetLoaded(java.sql.ResultSet rs,
                                              int i,
                                              org.hibernate.persister.entity.Loadable persister,
                                              java.lang.String rowIdAlias,
                                              org.hibernate.engine.EntityKey key,
                                              org.hibernate.LockMode lockMode,
                                              org.hibernate.engine.EntityKey optionalObjectKey,
                                              java.lang.Object optionalObject,
                                              java.util.List hydratedObjects,
                                              org.hibernate.engine.SessionImplementor session)
                                       throws org.hibernate.HibernateException,
                                              java.sql.SQLException
The entity instance is not in the session cache


isEagerPropertyFetchEnabled

private boolean isEagerPropertyFetchEnabled(int i)

loadFromResultSet

private void loadFromResultSet(java.sql.ResultSet rs,
                               int i,
                               java.lang.Object object,
                               java.lang.String instanceEntityName,
                               org.hibernate.engine.EntityKey key,
                               java.lang.String rowIdAlias,
                               org.hibernate.LockMode lockMode,
                               org.hibernate.persister.entity.Loadable rootPersister,
                               org.hibernate.engine.SessionImplementor session)
                        throws java.sql.SQLException,
                               org.hibernate.HibernateException
Hydrate the state an object from the SQL ResultSet, into an array or "hydrated" values (do not resolve associations yet), and pass the hydrates state to the session.


getInstanceClass

private java.lang.String getInstanceClass(java.sql.ResultSet rs,
                                          int i,
                                          org.hibernate.persister.entity.Loadable persister,
                                          java.io.Serializable id,
                                          org.hibernate.engine.SessionImplementor session)
                                   throws org.hibernate.HibernateException,
                                          java.sql.SQLException
Determine the concrete class of an instance in the ResultSet


advance

private void advance(java.sql.ResultSet rs,
                     org.hibernate.engine.RowSelection selection)
              throws java.sql.SQLException
Advance the cursor to the first required row of the ResultSet


hasMaxRows

private static boolean hasMaxRows(org.hibernate.engine.RowSelection selection)

getFirstRow

private static int getFirstRow(org.hibernate.engine.RowSelection selection)

useLimit

private static boolean useLimit(org.hibernate.engine.RowSelection selection,
                                org.hibernate.dialect.Dialect dialect)
Should we pre-process the SQL string, adding a dialect-specific LIMIT clause.


bindPositionalParameters

protected int bindPositionalParameters(java.sql.PreparedStatement st,
                                       org.hibernate.engine.QueryParameters queryParameters,
                                       int start,
                                       org.hibernate.engine.SessionImplementor session)
                                throws java.sql.SQLException,
                                       org.hibernate.HibernateException
Bind positional parameter values to the PreparedStatement (these are parameters specified by a JDBC-style ?).


prepareQueryStatement

protected final java.sql.PreparedStatement prepareQueryStatement(org.hibernate.engine.QueryParameters queryParameters,
                                                                 boolean scroll,
                                                                 org.hibernate.engine.SessionImplementor session)
                                                          throws java.sql.SQLException,
                                                                 org.hibernate.HibernateException
Obtain a PreparedStatement with all parameters pre-bound. Bind JDBC-style ? parameters, named parameters, and limit parameters.


getMaxOrLimit

private static int getMaxOrLimit(org.hibernate.engine.RowSelection selection,
                                 org.hibernate.dialect.Dialect dialect)
Some dialect-specific LIMIT clauses require the maximium last row number, others require the maximum returned row count.


bindLimitParameters

private int bindLimitParameters(java.sql.PreparedStatement st,
                                int index,
                                org.hibernate.engine.RowSelection selection)
                         throws java.sql.SQLException
Bind parameters needed by the dialect-specific LIMIT clause


setMaxRows

private void setMaxRows(java.sql.PreparedStatement st,
                        org.hibernate.engine.RowSelection selection)
                 throws java.sql.SQLException
Use JDBC API to limit the number of rows returned by the SQL query if necessary


getResultSet

protected final java.sql.ResultSet getResultSet(java.sql.PreparedStatement st,
                                                boolean autodiscovertypes,
                                                boolean callable,
                                                org.hibernate.engine.RowSelection selection,
                                                org.hibernate.engine.SessionImplementor session)
                                         throws java.sql.SQLException,
                                                org.hibernate.HibernateException
Fetch a PreparedStatement, call setMaxRows and then execute it, advance to the first result and return an SQL ResultSet


autoDiscoverTypes

protected void autoDiscoverTypes(java.sql.ResultSet rs)

wrapResultSetIfEnabled

private java.sql.ResultSet wrapResultSetIfEnabled(java.sql.ResultSet rs,
                                                  org.hibernate.engine.SessionImplementor session)

retreiveColumnNameToIndexCache

private org.hibernate.jdbc.ColumnNameCache retreiveColumnNameToIndexCache(java.sql.ResultSet rs)
                                                                   throws java.sql.SQLException

bindNamedParameters

protected int bindNamedParameters(java.sql.PreparedStatement ps,
                                  java.util.Map namedParams,
                                  int start,
                                  org.hibernate.engine.SessionImplementor session)
                           throws java.sql.SQLException,
                                  org.hibernate.HibernateException
Bind named parameters to the PreparedStatement. This has an empty implementation on this superclass and should be implemented by subclasses (queries) which allow named parameters.


getNamedParameterLocs

public int[] getNamedParameterLocs(java.lang.String name)

loadEntity

protected final java.util.List loadEntity(org.hibernate.engine.SessionImplementor session,
                                          java.lang.Object id,
                                          org.hibernate.type.Type identifierType,
                                          java.lang.Object optionalObject,
                                          java.lang.String optionalEntityName,
                                          java.io.Serializable optionalIdentifier,
                                          org.hibernate.persister.entity.EntityPersister persister)
                                   throws org.hibernate.HibernateException
Called by subclasses that load entities


loadEntity

protected final java.util.List loadEntity(org.hibernate.engine.SessionImplementor session,
                                          java.lang.Object key,
                                          java.lang.Object index,
                                          org.hibernate.type.Type keyType,
                                          org.hibernate.type.Type indexType,
                                          org.hibernate.persister.entity.EntityPersister persister)
                                   throws org.hibernate.HibernateException
Called by subclasses that load entities


loadEntityBatch

public final java.util.List loadEntityBatch(org.hibernate.engine.SessionImplementor session,
                                            java.io.Serializable[] ids,
                                            org.hibernate.type.Type idType,
                                            java.lang.Object optionalObject,
                                            java.lang.String optionalEntityName,
                                            java.io.Serializable optionalId,
                                            org.hibernate.persister.entity.EntityPersister persister)
                                     throws org.hibernate.HibernateException
Called by wrappers that batch load entities


loadCollection

public final void loadCollection(org.hibernate.engine.SessionImplementor session,
                                 java.io.Serializable id,
                                 org.hibernate.type.Type type)
                          throws org.hibernate.HibernateException
Called by subclasses that initialize collections


loadCollectionBatch

public final void loadCollectionBatch(org.hibernate.engine.SessionImplementor session,
                                      java.io.Serializable[] ids,
                                      org.hibernate.type.Type type)
                               throws org.hibernate.HibernateException
Called by wrappers that batch initialize collections


loadCollectionSubselect

protected final void loadCollectionSubselect(org.hibernate.engine.SessionImplementor session,
                                             java.io.Serializable[] ids,
                                             java.lang.Object[] parameterValues,
                                             org.hibernate.type.Type[] parameterTypes,
                                             java.util.Map namedParameters,
                                             org.hibernate.type.Type type)
                                      throws org.hibernate.HibernateException
Called by subclasses that batch initialize collections


list

protected java.util.List list(org.hibernate.engine.SessionImplementor session,
                              org.hibernate.engine.QueryParameters queryParameters,
                              java.util.Set querySpaces,
                              org.hibernate.type.Type[] resultTypes)
                       throws org.hibernate.HibernateException
Return the query results, using the query cache, called by subclasses that implement cacheable queries


listIgnoreQueryCache

private java.util.List listIgnoreQueryCache(org.hibernate.engine.SessionImplementor session,
                                            org.hibernate.engine.QueryParameters queryParameters)

listUsingQueryCache

private java.util.List listUsingQueryCache(org.hibernate.engine.SessionImplementor session,
                                           org.hibernate.engine.QueryParameters queryParameters,
                                           java.util.Set querySpaces,
                                           org.hibernate.type.Type[] resultTypes)