|
|||||||||||
| 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
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 |
|
| Method Summary | |
protected String |
applyLocks(String sql,
Map lockModes,
Dialect dialect)
Append FOR UPDATE OF clause, if necessary. |
protected int |
bindNamedParameters(PreparedStatement ps,
Map namedParams,
int start,
SessionImplementor session)
Bind named parameters to the PreparedStatement. |
void |
compile(Map replacements,
boolean scalar)
Compile a "normal" query. |
void |
compile(String collectionRole,
Map replacements,
boolean scalar)
Compile a filter. |
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 |
getCollectionOwner()
Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie. |
CollectionPersister |
getCollectionPersister()
Overrides method from Loader |
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)
Returns the locations of the specified named parameter in the SQL. |
protected EntityType[] |
getOwnerAssociationTypes()
An array of unique key property names by which the corresponding entities are referenced by other entities in the result set |
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()
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,
ResultSet rs,
SessionImplementor session)
Get the actual object that is returned in the user-visible result list. |
protected List |
getResultList(List results)
|
String[] |
getReturnAliases()
Returns an array of HQL aliases |
Type[] |
getReturnTypes()
Types of the return values of an iterate() style query. |
String |
getSQLString()
Returns the SQL string generated by the translator. |
protected String[] |
getSuffixes()
|
protected boolean |
isCompiled()
|
protected boolean |
isSubselectLoadingEnabled()
|
Iterator |
iterate(QueryParameters queryParameters,
SessionImplementor 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 |
| Methods inherited from class org.hibernate.loader.BasicLoader |
generateSuffixes, getEntityAliases, postInstantiate |
| Methods inherited from class org.hibernate.loader.Loader |
bindPositionalParameters, doList, getEntityEagerPropertyFetches, getFactory, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntityBatch, loadSingleRow, prepareQueryStatement, preprocessSQL, scroll |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public QueryTranslatorImpl(String queryString,
Map enabledFilters,
SessionFactoryImplementor 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?
MappingException - There was a problem querying defined mappings.
QueryException - There was a problem parsing the query string.
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?
MappingException - There was a problem querying defined mappings.
QueryException - There was a problem parsing the query string.public String getSQLString()
QueryTranslator
getSQLString in interface QueryTranslatorgetSQLString in class Loaderpublic 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
QueryTranslator
getNamedParameterLocs in interface QueryTranslatorname - The name of the named parameter.
QueryException - if something goes wrong.public final Set getQuerySpaces()
QueryTranslator
getQuerySpaces in interface QueryTranslatorpublic CollectionPersister getCollectionPersister()
getCollectionPersister in class Loaderprotected String[] getSuffixes()
getSuffixes in class BasicLoaderprotected String[] getAliases()
Loader
getAliases in class Loader
protected int bindNamedParameters(PreparedStatement ps,
Map namedParams,
int start,
SessionImplementor session)
throws SQLException,
HibernateException
Loader
bindNamedParameters in class LoaderSQLException
HibernateException
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,
SessionImplementor 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,
ResultSet rs,
SessionImplementor session)
throws SQLException,
HibernateException
Loader
getResultColumnOrRow in class LoaderSQLException
HibernateException
protected List getResultList(List results)
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 getCollectionOwner()
Loader
getCollectionOwner in class Loaderprotected boolean isCompiled()
public String toString()
toString in class Loaderprotected int[] getOwners()
Loader
getOwners in class Loaderprotected EntityType[] getOwnerAssociationTypes()
Loader
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.
HibernateExceptionprotected String getQueryIdentifier()
Loader
getQueryIdentifier in class Loaderprotected boolean isSubselectLoadingEnabled()
isSubselectLoadingEnabled in class Loader
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||