org.hibernate.loader.custom
Class CustomLoader

java.lang.Object
  extended byorg.hibernate.loader.Loader
      extended byorg.hibernate.loader.custom.CustomLoader

public class CustomLoader
extends Loader

Extension point for loaders which use a SQL result set with "unexpected" column aliases.

Author:
Gavin King

Constructor Summary
CustomLoader(CustomQuery customQuery, SessionFactoryImplementor factory)
           
 
Method Summary
protected  void autoDiscoverTypes(ResultSet rs)
           
protected  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  CollectionPersister[] getCollectionPersisters()
          An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
protected  EntityAliases[] getEntityAliases()
          Get the result set descriptor
protected  Loadable[] getEntityPersisters()
          An array of persisters of entity classes contained in each row of results; implemented by all subclasses
protected  LockMode[] getLockModes(Map lockModesMap)
          What lock mode does this load entities with?
 int[] getNamedParameterLocs(String name)
           
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  String getQueryIdentifier()
          Identifies the query for statistics reporting, if null, no statistics will be reported
 Set getQuerySpaces()
           
protected  Object getResultColumnOrRow(Object[] row, ResultSet rs, SessionImplementor session)
          Get the actual object that is returned in the user-visible result list.
protected  String getSQLString()
          The SQL query string to be called; implemented by all subclasses
 List list(SessionImplementor session, QueryParameters queryParameters)
           
 ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session)
           
 
Methods inherited from class org.hibernate.loader.Loader
applyLocks, bindNamedParameters, bindPositionalParameters, checkScrollability, doList, getAliases, getEntityEagerPropertyFetches, getFactory, getOwnerAssociationTypes, getResultList, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, isSubselectLoadingEnabled, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, postInstantiate, prepareQueryStatement, preprocessSQL, scroll, toString, upgradeLocks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CustomLoader

public CustomLoader(CustomQuery customQuery,
                    SessionFactoryImplementor factory)
Method Detail

getSQLString

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

Specified by:
getSQLString in class Loader

getEntityPersisters

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

Specified by:
getEntityPersisters in class Loader

getLockModes

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

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

getCollectionPersisters

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

Overrides:
getCollectionPersisters in class Loader

getCollectionOwners

protected int[] getCollectionOwners()
Description copied from class: Loader
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.

Overrides:
getCollectionOwners in class Loader

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

Overrides:
getOwners in class Loader

getQuerySpaces

public Set getQuerySpaces()

getQueryIdentifier

protected String getQueryIdentifier()
Description copied from class: Loader
Identifies the query for statistics reporting, if null, no statistics will be reported

Overrides:
getQueryIdentifier in class Loader

list

public List list(SessionImplementor session,
                 QueryParameters queryParameters)
          throws HibernateException
Throws:
HibernateException

scroll

public ScrollableResults scroll(QueryParameters queryParameters,
                                SessionImplementor session)
                         throws HibernateException
Throws:
HibernateException

autoDiscoverTypes

protected void autoDiscoverTypes(ResultSet rs)
Overrides:
autoDiscoverTypes in class Loader

getResultColumnOrRow

protected Object getResultColumnOrRow(Object[] row,
                                      ResultSet rs,
                                      SessionImplementor session)
                               throws SQLException,
                                      HibernateException
Description copied from class: Loader
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.

Overrides:
getResultColumnOrRow in class Loader
Throws:
SQLException
HibernateException

getEntityAliases

protected EntityAliases[] getEntityAliases()
Description copied from class: Loader
Get the result set descriptor

Specified by:
getEntityAliases in class Loader

getCollectionAliases

protected CollectionAliases[] getCollectionAliases()
Specified by:
getCollectionAliases in class Loader

getNamedParameterLocs

public int[] getNamedParameterLocs(String name)
                            throws QueryException
Overrides:
getNamedParameterLocs in class Loader
Throws:
QueryException