public class

CustomLoader

extends Loader
java.lang.Object
   ↳ org.hibernate.loader.Loader
     ↳ org.hibernate.loader.custom.CustomLoader

Class Overview

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

Summary

Nested Classes
class CustomLoader.NonScalarResultColumnProcessor  
class CustomLoader.ResultRowProcessor  
class CustomLoader.ScalarResultColumnProcessor  
Public Constructors
CustomLoader(CustomQuery customQuery, SessionFactoryImplementor factory)
Public Methods
int[] getNamedParameterLocs(String name)
Set getQuerySpaces()
List list(SessionImplementor session, QueryParameters queryParameters)
ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session)
Protected Methods
void autoDiscoverTypes(ResultSet rs)
CollectionAliases[] getCollectionAliases()
int[] getCollectionOwners()
Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie.
CollectionPersister[] getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
EntityAliases[] getEntityAliases()
Get the result set descriptor
Loadable[] getEntityPersisters()
An array of persisters of entity classes contained in each row of results; implemented by all subclasses
LockMode[] getLockModes(LockOptions lockOptions)
What lock options does this load entities with?
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").
String getQueryIdentifier()
Identifies the query for statistics reporting, if null, no statistics will be reported
Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session)
Get the actual object that is returned in the user-visible result list.
List getResultList(List results, ResultTransformer resultTransformer)
String getSQLString()
The SQL query string to be called; implemented by all subclasses
ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer)
Determine the actual ResultTransformer that will be used to transform query results.
[Expand]
Inherited Methods
From class org.hibernate.loader.Loader
From class java.lang.Object

Public Constructors

public CustomLoader (CustomQuery customQuery, SessionFactoryImplementor factory)

Public Methods

public int[] getNamedParameterLocs (String name)

public Set getQuerySpaces ()

public List list (SessionImplementor session, QueryParameters queryParameters)

public ScrollableResults scroll (QueryParameters queryParameters, SessionImplementor session)

Protected Methods

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. in the case of a collection initializer) or no collection.

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

Returns
  • The entity persisters.

protected LockMode[] getLockModes (LockOptions lockOptions)

What lock options does this load entities with?

Parameters
lockOptions a collection of lock options specified dynamically via the Query interface

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"). The indexes contained here are relative to the result of getEntityPersisters().

Returns
  • The owner indicators (see discussion above).

protected String getQueryIdentifier ()

Identifies the query for statistics reporting, if null, no statistics will be reported

protected Object getResultColumnOrRow (Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session)

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.

protected List getResultList (List results, ResultTransformer resultTransformer)

protected String getSQLString ()

The SQL query string to be called; implemented by all subclasses

Returns
  • The sql command this loader should use to get its ResultSet.

protected ResultTransformer resolveResultTransformer (ResultTransformer resultTransformer)

Determine the actual ResultTransformer that will be used to transform query results.

Parameters
resultTransformer the specified result transformer
Returns
  • the actual result transformer