public final class CriteriaImpl.Subcriteria extends java.lang.Object implements Criteria, java.io.Serializable
ALIAS_TO_ENTITY_MAP, DISTINCT_ROOT_ENTITY, FULL_JOIN, INNER_JOIN, LEFT_JOIN, PROJECTION, ROOT_ALIAS, ROOT_ENTITY
Modifier and Type | Method and Description |
---|---|
Criteria |
add(Criterion expression)
Add a
restriction to constrain the results to be
retrieved. |
Criteria |
addOrder(Order order)
Add an
ordering to the result set. |
Criteria |
addQueryHint(java.lang.String queryHint)
Add a DB query hint to the SQL.
|
Criteria |
createAlias(java.lang.String associationPath,
java.lang.String alias)
Join an association, assigning an alias to the joined association.
|
Criteria |
createAlias(java.lang.String associationPath,
java.lang.String alias,
int joinType)
Join an association using the specified join-type, assigning an alias
to the joined association.
|
Criteria |
createAlias(java.lang.String associationPath,
java.lang.String alias,
int joinType,
Criterion withClause)
Join an association using the specified join-type, assigning an alias
to the joined association.
|
Criteria |
createAlias(java.lang.String associationPath,
java.lang.String alias,
JoinType joinType)
Join an association using the specified join-type, assigning an alias
to the joined association.
|
Criteria |
createAlias(java.lang.String associationPath,
java.lang.String alias,
JoinType joinType,
Criterion withClause)
Join an association using the specified join-type, assigning an alias
to the joined association.
|
Criteria |
createCriteria(java.lang.String associationPath)
Create a new Criteria, "rooted" at the associated entity.
|
Criteria |
createCriteria(java.lang.String associationPath,
int joinType)
Create a new Criteria, "rooted" at the associated entity, using the
specified join type.
|
Criteria |
createCriteria(java.lang.String associationPath,
JoinType joinType)
Create a new Criteria, "rooted" at the associated entity, using the
specified join type.
|
Criteria |
createCriteria(java.lang.String associationPath,
java.lang.String alias)
Create a new Criteria, "rooted" at the associated entity,
assigning the given alias.
|
Criteria |
createCriteria(java.lang.String associationPath,
java.lang.String alias,
int joinType)
Create a new Criteria, "rooted" at the associated entity,
assigning the given alias and using the specified join type.
|
Criteria |
createCriteria(java.lang.String associationPath,
java.lang.String alias,
int joinType,
Criterion withClause)
Create a new Criteria, "rooted" at the associated entity,
assigning the given alias and using the specified join type.
|
Criteria |
createCriteria(java.lang.String associationPath,
java.lang.String alias,
JoinType joinType)
Create a new Criteria, "rooted" at the associated entity,
assigning the given alias and using the specified join type.
|
Criteria |
createCriteria(java.lang.String associationPath,
java.lang.String alias,
JoinType joinType,
Criterion withClause)
Create a new Criteria, "rooted" at the associated entity,
assigning the given alias and using the specified join type.
|
java.lang.String |
getAlias()
Get the alias of the entity encapsulated by this criteria instance.
|
JoinType |
getJoinType() |
LockMode |
getLockMode() |
Criteria |
getParent() |
java.lang.String |
getPath() |
Criterion |
getWithClause() |
boolean |
hasRestriction() |
boolean |
isReadOnly()
Should entities and proxies loaded by this Criteria be put in read-only mode? If the
read-only/modifiable setting was not initialized, then the default
read-only/modifiable setting for the persistence context is returned instead.
|
boolean |
isReadOnlyInitialized()
Was the read-only/modifiable mode explicitly initialized?
|
java.util.List |
list()
Get the results.
|
ScrollableResults |
scroll()
Get the results as an instance of
ScrollableResults . |
ScrollableResults |
scroll(ScrollMode scrollMode)
Get the results as an instance of
ScrollableResults based on the
given scroll mode. |
void |
setAlias(java.lang.String alias) |
Criteria |
setCacheable(boolean cacheable)
Enable caching of this query result, provided query caching is enabled
for the underlying session factory.
|
Criteria |
setCacheMode(CacheMode cacheMode)
Override the cache mode for this particular query.
|
Criteria |
setCacheRegion(java.lang.String cacheRegion)
Set the name of the cache region to use for query result caching.
|
Criteria |
setComment(java.lang.String comment)
Add a comment to the generated SQL.
|
Criteria |
setFetchMode(java.lang.String associationPath,
FetchMode mode)
Specify an association fetching strategy for an association or a
collection of values.
|
Criteria |
setFetchSize(int fetchSize)
Set a fetch size for the underlying JDBC query.
|
Criteria |
setFirstResult(int firstResult)
Set the first result to be retrieved.
|
Criteria |
setFlushMode(FlushMode flushMode)
Override the flush mode for this particular query.
|
Criteria |
setLockMode(LockMode lockMode)
Set the lock mode of the current entity.
|
Criteria |
setLockMode(java.lang.String alias,
LockMode lockMode)
Set the lock mode of the aliased entity.
|
Criteria |
setMaxResults(int maxResults)
Set a limit upon the number of objects to be retrieved.
|
Criteria |
setProjection(Projection projection)
Used to specify that the query results will be a projection (scalar in
nature).
|
Criteria |
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies
loaded by this Criteria.
|
Criteria |
setResultTransformer(ResultTransformer resultProcessor)
Set a strategy for handling the query results.
|
Criteria |
setTimeout(int timeout)
Set a timeout for the underlying JDBC query.
|
java.lang.String |
toString() |
java.lang.Object |
uniqueResult()
Convenience method to return a single instance that matches
the query, or null if the query returns no results.
|
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getAlias()
Criteria
public void setAlias(java.lang.String alias)
public java.lang.String getPath()
public Criteria getParent()
public LockMode getLockMode()
public Criteria setLockMode(LockMode lockMode)
Criteria
setLockMode
in interface Criteria
lockMode
- The lock mode to be appliedpublic JoinType getJoinType()
public Criterion getWithClause()
public boolean hasRestriction()
public Criteria add(Criterion expression)
Criteria
restriction
to constrain the results to be
retrieved.public Criteria addOrder(Order order)
Criteria
ordering
to the result set.public Criteria createAlias(java.lang.String associationPath, java.lang.String alias)
Criteria
Criteria.createAlias(String, String, JoinType )
using
JoinType.INNER_JOIN
for the joinType.createAlias
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).public Criteria createAlias(java.lang.String associationPath, java.lang.String alias, JoinType joinType) throws HibernateException
Criteria
JoinType.INNER_JOIN
(the default),
JoinType.FULL_JOIN
, or JoinType.LEFT_OUTER_JOIN
.createAlias
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createAlias(java.lang.String associationPath, java.lang.String alias, int joinType) throws HibernateException
Criteria
CriteriaSpecification.INNER_JOIN
(the default),
CriteriaSpecification.FULL_JOIN
, or CriteriaSpecification.LEFT_JOIN
.createAlias
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createAlias(java.lang.String associationPath, java.lang.String alias, JoinType joinType, Criterion withClause) throws HibernateException
Criteria
JoinType.INNER_JOIN
(the default),
JoinType.FULL_JOIN
, or JoinType.LEFT_OUTER_JOIN
.createAlias
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.withClause
- The criteria to be added to the join condition (ON clause)HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createAlias(java.lang.String associationPath, java.lang.String alias, int joinType, Criterion withClause) throws HibernateException
Criteria
CriteriaSpecification.INNER_JOIN
(the default),
CriteriaSpecification.FULL_JOIN
, or CriteriaSpecification.LEFT_JOIN
.createAlias
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.withClause
- The criteria to be added to the join condition (ON clause)HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath)
Criteria
Criteria.createCriteria(String, org.hibernate.sql.JoinType)
using
JoinType.INNER_JOIN
for the joinType.createCriteria
in interface Criteria
associationPath
- A dot-separated property pathpublic Criteria createCriteria(java.lang.String associationPath, JoinType joinType) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathjoinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath, int joinType) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathjoinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath, java.lang.String alias)
Criteria
Criteria.createCriteria(String, String, org.hibernate.sql.JoinType)
using
JoinType.INNER_JOIN
for the joinType.createCriteria
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).public Criteria createCriteria(java.lang.String associationPath, java.lang.String alias, JoinType joinType) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath, java.lang.String alias, int joinType) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath, java.lang.String alias, JoinType joinType, Criterion withClause) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.withClause
- The criteria to be added to the join condition (ON clause)HibernateException
- Indicates a problem creating the sub criteriapublic Criteria createCriteria(java.lang.String associationPath, java.lang.String alias, int joinType, Criterion withClause) throws HibernateException
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-separated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.withClause
- The criteria to be added to the join condition (ON clause)HibernateException
- Indicates a problem creating the sub criteriapublic boolean isReadOnly()
Criteria
isReadOnly
in interface Criteria
Criteria.setReadOnly(boolean)
,
The read-only/modifiable setting has no impact on entities/proxies returned by the
Criteria that existed in the session before the Criteria was executed.
,
Criteria.isReadOnlyInitialized()
public boolean isReadOnlyInitialized()
Criteria
isReadOnlyInitialized
in interface Criteria
Criteria.setReadOnly(boolean)
public Criteria setReadOnly(boolean readOnly)
Criteria
setReadOnly
in interface Criteria
readOnly
- true, entities and proxies loaded by the criteria will be put in read-only mode
false, entities and proxies loaded by the criteria will be put in modifiable modethis
, for method chainingTo set the default read-only/modifiable setting used for
entities and proxies that are loaded into the session:
,
PersistenceContext.setDefaultReadOnly(boolean)
,
Read-only entities are not dirty-checked and snapshots of persistent
state are not maintained. Read-only entities can be modified, but
changes are not persisted.
When a proxy is initialized, the loaded entity will have the same
read-only/modifiable setting as the uninitialized
proxy has, regardless of the session's current setting.
The read-only/modifiable setting has no impact on entities/proxies
returned by the criteria that existed in the session before the criteria was executed.
public Criteria setCacheable(boolean cacheable)
Criteria
setCacheable
in interface Criteria
cacheable
- Should the result be considered cacheable; default is
to not cache (false).public Criteria setCacheRegion(java.lang.String cacheRegion)
Criteria
setCacheRegion
in interface Criteria
cacheRegion
- the name of a query cache region, or null
for the default query cacheCriteria.setCacheable(boolean)
public java.util.List list() throws HibernateException
Criteria
list
in interface Criteria
HibernateException
- Indicates a problem either translating the criteria to SQL,
exeucting the SQL or processing the SQL results.public ScrollableResults scroll() throws HibernateException
Criteria
ScrollableResults
.scroll
in interface Criteria
ScrollableResults
representing the matched
query results.HibernateException
- Indicates a problem either translating the criteria to SQL,
exeucting the SQL or processing the SQL results.public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException
Criteria
ScrollableResults
based on the
given scroll mode.scroll
in interface Criteria
scrollMode
- Indicates the type of underlying database cursor to
request.ScrollableResults
representing the matched
query results.HibernateException
- Indicates a problem either translating the criteria to SQL,
exeucting the SQL or processing the SQL results.public java.lang.Object uniqueResult() throws HibernateException
Criteria
uniqueResult
in interface Criteria
HibernateException
- if there is more than one matching resultpublic Criteria setFetchMode(java.lang.String associationPath, FetchMode mode)
Criteria
setFetchMode
in interface Criteria
associationPath
- a dot separated property pathmode
- The fetch mode for the referenced associationpublic Criteria setFlushMode(FlushMode flushMode)
Criteria
setFlushMode
in interface Criteria
flushMode
- The flush mode to use.public Criteria setCacheMode(CacheMode cacheMode)
Criteria
setCacheMode
in interface Criteria
cacheMode
- The cache mode to use.public Criteria setFirstResult(int firstResult)
Criteria
setFirstResult
in interface Criteria
firstResult
- the first result to retrieve, numbered from 0public Criteria setMaxResults(int maxResults)
Criteria
setMaxResults
in interface Criteria
maxResults
- the maximum number of resultspublic Criteria setTimeout(int timeout)
Criteria
setTimeout
in interface Criteria
timeout
- The timeout value to apply.Statement.setQueryTimeout(int)
public Criteria setFetchSize(int fetchSize)
Criteria
setFetchSize
in interface Criteria
fetchSize
- the fetch sizeStatement.setFetchSize(int)
public Criteria setLockMode(java.lang.String alias, LockMode lockMode)
Criteria
setLockMode
in interface Criteria
alias
- The previously assigned alias representing the entity to
which the given lock mode should apply.lockMode
- The lock mode to be appliedpublic Criteria setResultTransformer(ResultTransformer resultProcessor)
Criteria
setResultTransformer
in interface Criteria
resultProcessor
- The transformer to applyCriteriaSpecification.ROOT_ENTITY
,
CriteriaSpecification.DISTINCT_ROOT_ENTITY
,
CriteriaSpecification.ALIAS_TO_ENTITY_MAP
,
CriteriaSpecification.PROJECTION
public Criteria setComment(java.lang.String comment)
Criteria
setComment
in interface Criteria
comment
- a human-readable stringpublic Criteria addQueryHint(java.lang.String queryHint)
Criteria
QueryHint
, which is specific
to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the
vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will
determine concatenation and placement.addQueryHint
in interface Criteria
queryHint
- The database specific query hint to add.public Criteria setProjection(Projection projection)
Criteria
CriteriaSpecification.PROJECTION
result transformer.
The individual components contained within the given
projection
determines the overall "shape" of the
query result.setProjection
in interface Criteria
projection
- The projection representing the overall "shape" of the
query results.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.