public class CustomLoader extends Loader
Loader.SqlStatementWrapper
DEBUG_ENABLED, LOG, SELECT, SELECT_DISTINCT
Constructor and Description |
---|
CustomLoader(CustomQuery customQuery,
SessionFactoryImplementor factory) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
applyLocks(java.lang.String sql,
QueryParameters parameters,
Dialect dialect,
java.util.List<AfterLoadAction> afterLoadActions)
Append FOR UPDATE OF clause, if necessary.
|
protected void |
autoDiscoverTypes(java.sql.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(LockOptions lockOptions)
What lock options does this load entities with?
|
int[] |
getNamedParameterLocs(java.lang.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 java.lang.String |
getQueryIdentifier()
Identifies the query for statistics reporting, if null,
no statistics will be reported
|
java.util.Set |
getQuerySpaces() |
protected java.lang.Object |
getResultColumnOrRow(java.lang.Object[] row,
ResultTransformer transformer,
java.sql.ResultSet rs,
SharedSessionContractImplementor session)
Get the actual object that is returned in the user-visible result list.
|
protected java.util.List |
getResultList(java.util.List results,
ResultTransformer resultTransformer) |
protected java.lang.Object[] |
getResultRow(java.lang.Object[] row,
java.sql.ResultSet rs,
SharedSessionContractImplementor session) |
protected java.lang.String[] |
getResultRowAliases()
Returns the aliases that corresponding to a result row.
|
java.lang.String |
getSQLString()
The SQL query string to be called; implemented by all subclasses
|
protected boolean[] |
includeInResultRow() |
java.util.List |
list(SharedSessionContractImplementor session,
QueryParameters queryParameters) |
protected void |
putResultInQueryCache(SharedSessionContractImplementor session,
QueryParameters queryParameters,
Type[] resultTypes,
QueryCache queryCache,
QueryKey key,
java.util.List result)
resultTypes can be overridden by autoDiscoverTypes(ResultSet) ,
*after* list(SharedSessionContractImplementor, QueryParameters) has already been called. |
protected ResultTransformer |
resolveResultTransformer(ResultTransformer resultTransformer)
Determine the actual ResultTransformer that will be used to
transform query results.
|
ScrollableResultsImplementor |
scroll(QueryParameters queryParameters,
SharedSessionContractImplementor session) |
protected void |
validateAlias(java.lang.String alias) |
applyPostLoadLocks, areResultSetRowsTransformedImmediately, bindNamedParameters, bindParameterValues, bindPositionalParameters, checkScrollability, determineFollowOnLockMode, doList, doQueryAndInitializeNonLazyCollections, doQueryAndInitializeNonLazyCollections, executeQueryStatement, executeQueryStatement, extractKeysFromResultSet, getAliases, getCompositeKeyManyToOneTargetIndices, getEntityEagerPropertyFetches, getFactory, getLimitHandler, getOwnerAssociationTypes, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, isSubselectLoadingEnabled, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, postInstantiate, prepareQueryStatement, preprocessSQL, processDistinctKeyword, processResultSet, scroll, shouldUseFollowOnLocking, toString, upgradeLocks
public CustomLoader(CustomQuery customQuery, SessionFactoryImplementor factory)
protected java.lang.String getQueryIdentifier()
Loader
getQueryIdentifier
in class Loader
public java.lang.String getSQLString()
Loader
getSQLString
in class Loader
ResultSet
.public java.util.Set getQuerySpaces()
protected LockMode[] getLockModes(LockOptions lockOptions)
Loader
getLockModes
in class Loader
lockOptions
- a collection of lock options specified dynamically via the Query interfaceprotected Loadable[] getEntityPersisters()
Loader
getEntityPersisters
in class Loader
protected CollectionPersister[] getCollectionPersisters()
Loader
getCollectionPersisters
in class Loader
protected int[] getCollectionOwners()
Loader
getCollectionOwners
in class Loader
protected int[] getOwners()
Loader
Loader.getEntityPersisters()
.public java.util.List list(SharedSessionContractImplementor session, QueryParameters queryParameters) throws HibernateException
HibernateException
protected java.lang.String applyLocks(java.lang.String sql, QueryParameters parameters, Dialect dialect, java.util.List<AfterLoadAction> afterLoadActions) throws QueryException
Loader
applyLocks
in class Loader
QueryException
public ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
HibernateException
protected java.lang.String[] getResultRowAliases()
Loader
getResultRowAliases
in class Loader
protected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer)
Loader
resolveResultTransformer
in class Loader
resultTransformer
- the specified result transformerprotected boolean[] includeInResultRow()
includeInResultRow
in class Loader
protected java.lang.Object getResultColumnOrRow(java.lang.Object[] row, ResultTransformer transformer, java.sql.ResultSet rs, SharedSessionContractImplementor session) throws java.sql.SQLException, HibernateException
Loader
getResultColumnOrRow
in class Loader
java.sql.SQLException
HibernateException
protected java.lang.Object[] getResultRow(java.lang.Object[] row, java.sql.ResultSet rs, SharedSessionContractImplementor session) throws java.sql.SQLException, HibernateException
getResultRow
in class Loader
java.sql.SQLException
HibernateException
protected java.util.List getResultList(java.util.List results, ResultTransformer resultTransformer) throws QueryException
getResultList
in class Loader
QueryException
protected EntityAliases[] getEntityAliases()
Loader
getEntityAliases
in class Loader
protected CollectionAliases[] getCollectionAliases()
getCollectionAliases
in class Loader
public int[] getNamedParameterLocs(java.lang.String name) throws QueryException
getNamedParameterLocs
in class Loader
QueryException
protected void autoDiscoverTypes(java.sql.ResultSet rs)
autoDiscoverTypes
in class Loader
protected void validateAlias(java.lang.String alias)
protected void putResultInQueryCache(SharedSessionContractImplementor session, QueryParameters queryParameters, Type[] resultTypes, QueryCache queryCache, QueryKey key, java.util.List result)
resultTypes
can be overridden by autoDiscoverTypes(ResultSet)
,
*after* list(SharedSessionContractImplementor, QueryParameters)
has already been called. It's a bit of a
chicken-and-the-egg issue since autoDiscoverTypes(ResultSet)
needs the ResultSet
.
As a hacky workaround, overriden here to provide the resultTypes
.
see HHH-3051putResultInQueryCache
in class Loader
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.