|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.loader.Loader
org.hibernate.loader.BasicLoader
org.hibernate.hql.classic.QueryTranslatorImpl
public class QueryTranslatorImpl
An instance of QueryTranslator translates a Hibernate query string to SQL.
| 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 | |
|---|---|
QueryTranslatorImpl(String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator; this form used internally. |
|
QueryTranslatorImpl(String queryIdentifier,
String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator |
|
| Method Summary | |
|---|---|
protected String |
applyLocks(String sql,
Map lockModes,
Dialect dialect)
Append FOR UPDATE OF clause, if necessary. |
List |
collectSqlStrings()
|
void |
compile(Map replacements,
boolean scalar)
Compile a "normal" query. |
void |
compile(String collectionRole,
Map replacements,
boolean scalar)
Compile a filter. |
boolean |
containsCollectionFetches()
Does the translated query contain collection fetches? |
int |
executeUpdate(QueryParameters queryParameters,
SessionImplementor session)
Perform a bulk update/delete operation given the underlying query defintion. |
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 |
String |
getAliasName(String alias)
|
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. |
CollectionPersister[] |
getCollectionPersisters()
Overrides method from Loader |
protected String[] |
getCollectionSuffixes()
|
String[][] |
getColumnNames()
Returns the column names in the generated SQL. |
Map |
getEnabledFilters()
Returns the filters enabled for this query translator. |
protected Loadable[] |
getEntityPersisters()
Persisters for the return values of a find() style query. |
Class |
getHolderClass()
|
protected LockMode[] |
getLockModes(Map lockModes)
What lock mode does this load entities with? |
int[] |
getNamedParameterLocs(String name)
|
protected EntityType[] |
getOwnerAssociationTypes()
An array of the owner types corresponding to the Loader.getOwners()
returns. |
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"). |
ParameterTranslations |
getParameterTranslations()
Return information about any parameters encountered during translation. |
String |
getQueryIdentifier()
Identifies the query for statistics reporting, if null, no statistics will be reported |
Set |
getQuerySpaces()
Returns the set of query spaces (table names) that the query referrs to. |
String |
getQueryString()
Returns the HQL string processed by the translator. |
protected Object |
getResultColumnOrRow(Object[] row,
ResultTransformer transformer,
ResultSet rs,
SessionImplementor session)
Get the actual object that is returned in the user-visible result list. |
protected List |
getResultList(List results,
ResultTransformer resultTransformer)
|
String[] |
getReturnAliases()
Returns an array of HQL aliases |
Type[] |
getReturnTypes()
Types of the return values of an iterate() style query. |
String |
getSQLString()
The SQL query string to be called; implemented by all subclasses |
protected String[] |
getSuffixes()
|
protected boolean |
isCompiled()
|
boolean |
isManipulationStatement()
|
protected boolean |
isSubselectLoadingEnabled()
|
Iterator |
iterate(QueryParameters queryParameters,
EventSource session)
Return the query results as an iterator |
List |
list(SessionImplementor session,
QueryParameters queryParameters)
Perform a list operation given the underlying query definition. |
ScrollableResults |
scroll(QueryParameters queryParameters,
SessionImplementor session)
Perform a scroll operation given the underlying query defintion. |
String |
toString()
|
protected boolean |
upgradeLocks()
Does this query return objects that might be already cached by the session, whose lock mode may need upgrading |
void |
validateScrollability()
Validate the scrollability of the translated query. |
| Methods inherited from class org.hibernate.loader.BasicLoader |
|---|
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public QueryTranslatorImpl(String queryIdentifier,
String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
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 by QuerySplitter.enabledFilters - Any enabled filters.factory - The session factory.
public QueryTranslatorImpl(String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
queryString - The query string to process.enabledFilters - Any enabled filters.factory - The session factory.| Method Detail |
|---|
public void compile(Map replacements,
boolean scalar)
throws QueryException,
MappingException
compile in interface QueryTranslatorreplacements - Defined query substitutions.scalar - Does this represent a shallow (scalar or entity-id) select?
QueryException - There was a problem parsing the query string.
MappingException - There was a problem querying defined mappings.
public void compile(String collectionRole,
Map replacements,
boolean scalar)
throws QueryException,
MappingException
compile in interface FilterTranslatorcollectionRole - the role name of the collection used as the basis for the filter.replacements - Defined query substitutions.scalar - Does this represent a shallow (scalar or entity-id) select?
QueryException - There was a problem parsing the query string.
MappingException - There was a problem querying defined mappings.public String getSQLString()
Loader
getSQLString in interface QueryTranslatorgetSQLString in class LoaderResultSet.public List collectSqlStrings()
collectSqlStrings in interface QueryTranslatorpublic String getQueryString()
QueryTranslator
getQueryString in interface QueryTranslatorprotected Loadable[] getEntityPersisters()
getEntityPersisters in class Loaderpublic Type[] getReturnTypes()
getReturnTypes in interface QueryTranslatorpublic String[] getReturnAliases()
QueryTranslator
getReturnAliases in interface QueryTranslatorpublic String[][] getColumnNames()
QueryTranslator
getColumnNames in interface QueryTranslatorpublic String getAliasName(String alias)
public int[] getNamedParameterLocs(String name)
throws QueryException
getNamedParameterLocs in class LoaderQueryExceptionpublic final Set getQuerySpaces()
QueryTranslator
getQuerySpaces in interface QueryTranslatorpublic CollectionPersister[] getCollectionPersisters()
getCollectionPersisters in class Loaderprotected String[] getCollectionSuffixes()
getCollectionSuffixes in class BasicLoaderprotected String[] getSuffixes()
getSuffixes in class BasicLoaderprotected String[] getAliases()
Loader
getAliases in class Loader
public List list(SessionImplementor session,
QueryParameters queryParameters)
throws HibernateException
QueryTranslator
list in interface QueryTranslatorsession - The session owning this query.queryParameters - The query bind parameters.
HibernateException
public Iterator iterate(QueryParameters queryParameters,
EventSource session)
throws HibernateException
iterate in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.
HibernateException
public int executeUpdate(QueryParameters queryParameters,
SessionImplementor session)
throws HibernateException
QueryTranslator
executeUpdate in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.
HibernateException
protected Object getResultColumnOrRow(Object[] row,
ResultTransformer transformer,
ResultSet rs,
SessionImplementor session)
throws SQLException,
HibernateException
Loader
getResultColumnOrRow in class LoaderSQLException
HibernateException
protected List getResultList(List results,
ResultTransformer resultTransformer)
throws QueryException
getResultList in class LoaderQueryExceptionprotected LockMode[] getLockModes(Map lockModes)
Loader
getLockModes in class LoaderlockModes - a collection of lock modes specified dynamically via the Query interface
protected String applyLocks(String sql,
Map lockModes,
Dialect dialect)
throws QueryException
Loader
applyLocks in class LoaderQueryExceptionprotected boolean upgradeLocks()
Loader
upgradeLocks in class Loaderprotected int[] getCollectionOwners()
Loader
getCollectionOwners in class Loaderprotected boolean isCompiled()
public String toString()
toString in class Loaderprotected int[] getOwners()
LoaderLoader.getEntityPersisters().
getOwners in class Loaderprotected EntityType[] getOwnerAssociationTypes()
LoaderLoader.getOwners()
returns. Indices indicating no owner would be null here.
getOwnerAssociationTypes in class Loaderpublic Class getHolderClass()
public Map getEnabledFilters()
QueryTranslator
getEnabledFilters in interface QueryTranslator
public ScrollableResults scroll(QueryParameters queryParameters,
SessionImplementor session)
throws HibernateException
QueryTranslator
scroll in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.
HibernateExceptionpublic String getQueryIdentifier()
Loader
getQueryIdentifier in interface QueryTranslatorgetQueryIdentifier in class Loaderprotected boolean isSubselectLoadingEnabled()
isSubselectLoadingEnabled in class Loader
public void validateScrollability()
throws HibernateException
QueryTranslator
validateScrollability in interface QueryTranslatorHibernateExceptionpublic boolean containsCollectionFetches()
QueryTranslator
containsCollectionFetches in interface QueryTranslatorpublic boolean isManipulationStatement()
isManipulationStatement in interface QueryTranslatorpublic ParameterTranslations getParameterTranslations()
QueryTranslator
getParameterTranslations in interface QueryTranslator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||