Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.hibernate.loader.Loader
org.hibernate.loader.BasicLoader
org.hibernate.hql.classic.QueryTranslatorImpl
Field Summary |
Fields inherited from class org.hibernate.loader.BasicLoader | |
NO_SUFFIX |
Fields inherited from interface org.hibernate.hql.QueryTranslator | |
ERROR_CANNOT_DETERMINE_TYPE , ERROR_CANNOT_FETCH_WITH_ITERATE , ERROR_CANNOT_FORMAT_LITERAL , ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR |
Constructor Summary | |
| |
|
Method Summary | |
protected String |
|
List | |
void |
|
void |
|
boolean |
|
int |
|
String |
|
protected String[] |
|
protected int[] |
|
CollectionPersister[] |
|
protected String[] | |
String[][] |
|
Map |
|
protected Loadable[] |
|
Class | |
protected LockMode[] |
|
int[] |
|
protected EntityType[] |
|
protected int[] |
|
ParameterTranslations |
|
String |
|
Set |
|
String |
|
protected Object |
|
protected List |
|
String[] |
|
Type[] |
|
String |
|
protected String[] | |
protected boolean | |
boolean | |
protected boolean | |
Iterator |
|
List |
|
ScrollableResults |
|
String |
|
protected boolean |
|
void |
|
Methods inherited from class org.hibernate.loader.BasicLoader | |
generateSuffixes , generateSuffixes , getCollectionAliases , getCollectionSuffixes , getEntityAliases , getSuffixes , postInstantiate |
public QueryTranslatorImpl(String queryString, Map enabledFilters, SessionFactoryImplementor factory)
Construct a query translator; this form used internally.
- Parameters:
queryString
- The query string to process.enabledFilters
- Any enabled filters.factory
- The session factory.
public QueryTranslatorImpl(String queryIdentifier, String queryString, Map enabledFilters, SessionFactoryImplementor factory)
Construct a query translator
- Parameters:
queryIdentifier
- A unique identifier for the query of which this translation is part; typically this is the original, user-supplied query string.queryString
- The "preprocessed" query string; at the very least already processed byQuerySplitter
.enabledFilters
- Any enabled filters.factory
- The session factory.
protected String applyLocks(String sql, Map lockModes, Dialect dialect) throws QueryException
Append FOR UPDATE OF clause, if necessary. This empty superclass implementation merely returns its first argument.
- Overrides:
- applyLocks in interface Loader
public List collectSqlStrings()
- Specified by:
- collectSqlStrings in interface QueryTranslator
public void compile(Map replacements, boolean scalar) throws QueryException, MappingException
Compile a "normal" query. This method may be called multiple times. Subsequent invocations are no-ops.
- Specified by:
- compile in interface QueryTranslator
public void compile(String collectionRole, Map replacements, boolean scalar) throws QueryException, MappingException
Compile a filter. This method may be called multiple times. Subsequent invocations are no-ops.
- Specified by:
- compile in interface FilterTranslator
public boolean containsCollectionFetches()
Does the translated query contain collection fetches?
- Specified by:
- containsCollectionFetches in interface QueryTranslator
- Returns:
- tru if the query does contain collection fetched; false otherwise.
public int executeUpdate(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
Perform a bulk update/delete operation given the underlying query defintion.
- Specified by:
- executeUpdate in interface QueryTranslator
- Parameters:
queryParameters
- The query bind parameters.session
- The session owning this query.
- Returns:
- The number of entities updated or deleted.
- Throws:
HibernateException
-
public String getAliasName(String alias)
protected String[] getAliases()
Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading
- Overrides:
- getAliases in interface Loader
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.
- Overrides:
- getCollectionOwners in interface Loader
public CollectionPersister[] getCollectionPersisters()
Overrides method from Loader
- Overrides:
- getCollectionPersisters in interface Loader
protected String[] getCollectionSuffixes()
- Overrides:
- getCollectionSuffixes in interface BasicLoader
public String[][] getColumnNames()
Returns the column names in the generated SQL.
- Specified by:
- getColumnNames in interface QueryTranslator
- Returns:
- the column names in the generated SQL.
public Map getEnabledFilters()
Returns the filters enabled for this query translator.
- Specified by:
- getEnabledFilters in interface QueryTranslator
- Returns:
- Filters enabled for this query execution.
protected Loadable[] getEntityPersisters()
Persisters for the return values of a find() style query.
- Overrides:
- getEntityPersisters in interface Loader
- Returns:
- an array of EntityPersisters.
public Class getHolderClass()
protected LockMode[] getLockModes(Map lockModes)
What lock mode does this load entities with?
- Overrides:
- getLockModes in interface Loader
- Parameters:
lockModes
- a collection of lock modes specified dynamically via the Query interface
public int[] getNamedParameterLocs(String name) throws QueryException
- Overrides:
- getNamedParameterLocs in interface Loader
protected EntityType[] getOwnerAssociationTypes()
An array of the owner types corresponding to theLoader.getOwners()
returns. Indices indicating no owner would be null here.
- Overrides:
- getOwnerAssociationTypes in interface Loader
- Returns:
- The types for the owners.
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 ofLoader.getEntityPersisters()
.
- Returns:
- The owner indicators (see discussion above).
public ParameterTranslations getParameterTranslations()
Return information about any parameters encountered during translation.
- Specified by:
- getParameterTranslations in interface QueryTranslator
- Returns:
- The parameter information.
public String getQueryIdentifier()
Retrieve the query identifier for this translator. The query identifier is used in stats collection.
- Specified by:
- getQueryIdentifier in interface QueryTranslator
- Overrides:
- getQueryIdentifier in interface Loader
- Returns:
- the identifier
public final Set getQuerySpaces()
Returns the set of query spaces (table names) that the query referrs to.
- Specified by:
- getQuerySpaces in interface QueryTranslator
- Returns:
- A set of query spaces (table names).
public String getQueryString()
Returns the HQL string processed by the translator.
- Specified by:
- getQueryString in interface QueryTranslator
- Returns:
- the HQL string processed by the translator.
protected Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session) throws SQLException, 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.
- Overrides:
- getResultColumnOrRow in interface Loader
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException
- Overrides:
- getResultList in interface Loader
public String[] getReturnAliases()
Returns an array of HQL aliases
- Specified by:
- getReturnAliases in interface QueryTranslator
public Type[] getReturnTypes()
Types of the return values of an iterate() style query.
- Specified by:
- getReturnTypes in interface QueryTranslator
- Returns:
- an array of Types.
public String getSQLString()
Returns the SQL string generated by the translator.
- Specified by:
- getSQLString in interface QueryTranslator
- Overrides:
- getSQLString in interface Loader
- Returns:
- the SQL string generated by the translator.
protected boolean isCompiled()
public boolean isManipulationStatement()
- Specified by:
- isManipulationStatement in interface QueryTranslator
protected boolean isSubselectLoadingEnabled()
- Overrides:
- isSubselectLoadingEnabled in interface Loader
public Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException
Return the query results as an iterator
- Specified by:
- iterate in interface QueryTranslator
public List list(SessionImplementor session, QueryParameters queryParameters) throws HibernateException
Perform a list operation given the underlying query definition.
- Specified by:
- list in interface QueryTranslator
- Parameters:
session
- The session owning this query.queryParameters
- The query bind parameters.
- Returns:
- The query list results.
- Throws:
HibernateException
-
public ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
Perform a scroll operation given the underlying query defintion.
- Specified by:
- scroll in interface QueryTranslator
- Parameters:
queryParameters
- The query bind parameters.session
- The session owning this query.
- Returns:
- The ScrollableResults wrapper around the query results.
- Throws:
HibernateException
-
protected boolean upgradeLocks()
Does this query return objects that might be already cached by the session, whose lock mode may need upgrading
- Overrides:
- upgradeLocks in interface Loader
public void validateScrollability() throws HibernateException
Validate the scrollability of the translated query.
- Specified by:
- validateScrollability in interface QueryTranslator
- Throws:
HibernateException
-