|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.impl.CriteriaImpl
public class CriteriaImpl
Implementation of the Criteria interface
Nested Class Summary | |
---|---|
static class |
CriteriaImpl.CriterionEntry
|
static class |
CriteriaImpl.OrderEntry
|
class |
CriteriaImpl.Subcriteria
|
Field Summary |
---|
Fields inherited from interface org.hibernate.criterion.CriteriaSpecification |
---|
ALIAS_TO_ENTITY_MAP, DISTINCT_ROOT_ENTITY, FULL_JOIN, INNER_JOIN, LEFT_JOIN, PROJECTION, ROOT_ALIAS, ROOT_ENTITY |
Constructor Summary | |
---|---|
CriteriaImpl(String entityOrClassName,
SessionImplementor session)
|
|
CriteriaImpl(String entityOrClassName,
String alias,
SessionImplementor session)
|
Method Summary | |
---|---|
Criteria |
add(Criteria criteriaInst,
Criterion expression)
|
Criteria |
add(Criterion expression)
Add a restriction to constrain the results to be
retrieved. |
Criteria |
addOrder(Order ordering)
Add an ordering to the result set. |
protected void |
after()
|
protected void |
before()
|
Criteria |
createAlias(String associationPath,
String alias)
Join an association, assigning an alias to the joined association. |
Criteria |
createAlias(String associationPath,
String alias,
int joinType)
Join an association using the specified join-type, assigning an alias to the joined association. |
Criteria |
createCriteria(String associationPath)
Create a new Criteria, "rooted" at the associated entity. |
Criteria |
createCriteria(String associationPath,
int joinType)
Create a new Criteria, "rooted" at the associated entity, using the specified join type. |
Criteria |
createCriteria(String associationPath,
String alias)
Create a new Criteria, "rooted" at the associated entity, assigning the given alias. |
Criteria |
createCriteria(String associationPath,
String alias,
int joinType)
Create a new Criteria, "rooted" at the associated entity, assigning the given alias and using the specified join type. |
String |
getAlias()
Get the alias of the entity encapsulated by this criteria instance. |
boolean |
getCacheable()
|
String |
getCacheRegion()
|
String |
getComment()
|
String |
getEntityOrClassName()
|
FetchMode |
getFetchMode(String path)
|
Integer |
getFetchSize()
|
Integer |
getFirstResult()
|
Map |
getLockModes()
|
Integer |
getMaxResults()
|
Projection |
getProjection()
|
Criteria |
getProjectionCriteria()
|
ResultTransformer |
getResultTransformer()
|
SessionImplementor |
getSession()
|
Integer |
getTimeout()
|
boolean |
isLookupByNaturalKey()
|
Iterator |
iterateExpressionEntries()
|
Iterator |
iterateOrderings()
|
Iterator |
iterateSubcriteria()
|
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. |
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(String cacheRegion)
Set the name of the cache region to use for query result caching. |
Criteria |
setComment(String comment)
Add a comment to the generated SQL. |
Criteria |
setFetchMode(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(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 |
setResultTransformer(ResultTransformer tupleMapper)
Set a strategy for handling the query results. |
void |
setSession(SessionImplementor session)
|
Criteria |
setTimeout(int timeout)
Set a timeout for the underlying JDBC query. |
String |
toString()
|
Object |
uniqueResult()
Convenience method to return a single instance that matches the query, or null if the query returns no results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CriteriaImpl(String entityOrClassName, SessionImplementor session)
public CriteriaImpl(String entityOrClassName, String alias, SessionImplementor session)
Method Detail |
---|
public String toString()
toString
in class Object
public SessionImplementor getSession()
public void setSession(SessionImplementor session)
public String getEntityOrClassName()
public Map getLockModes()
public Criteria getProjectionCriteria()
public Iterator iterateSubcriteria()
public Iterator iterateExpressionEntries()
public Iterator iterateOrderings()
public Criteria add(Criteria criteriaInst, Criterion expression)
public String getAlias()
Criteria
getAlias
in interface Criteria
public Projection getProjection()
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.
public Criteria add(Criterion expression)
Criteria
restriction
to constrain the results to be
retrieved.
add
in interface Criteria
expression
- The criterion
object representing the
restriction to be applied.
public Criteria addOrder(Order ordering)
Criteria
ordering
to the result set.
addOrder
in interface Criteria
ordering
- The order
object representing an ordering
to be applied to the results.
public FetchMode getFetchMode(String path)
public Criteria setFetchMode(String associationPath, FetchMode mode)
Criteria
setFetchMode
in interface Criteria
associationPath
- a dot seperated property pathmode
- The fetch mode for the referenced association
public Criteria setLockMode(LockMode lockMode)
Criteria
setLockMode
in interface Criteria
lockMode
- The lock mode to be applied
public Criteria setLockMode(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 applied
public Criteria createAlias(String associationPath, String alias)
Criteria
Criteria.createAlias(String, String, int)
using
CriteriaSpecification.INNER_JOIN
for the joinType.
createAlias
in interface Criteria
associationPath
- A dot-seperated property pathalias
- The alias to assign to the joined association (for later reference).
public Criteria createAlias(String associationPath, String alias, int joinType)
Criteria
CriteriaSpecification.INNER_JOIN
(the default),
CriteriaSpecification.FULL_JOIN
, or CriteriaSpecification.LEFT_JOIN
.
createAlias
in interface Criteria
associationPath
- A dot-seperated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.
public Criteria createCriteria(String associationPath)
Criteria
Criteria.createCriteria(String, int)
using
CriteriaSpecification.INNER_JOIN
for the joinType.
createCriteria
in interface Criteria
associationPath
- A dot-seperated property path
public Criteria createCriteria(String associationPath, int joinType)
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-seperated property pathjoinType
- The type of join to use.
public Criteria createCriteria(String associationPath, String alias)
Criteria
Criteria.createCriteria(String, String, int)
using
CriteriaSpecification.INNER_JOIN
for the joinType.
createCriteria
in interface Criteria
associationPath
- A dot-seperated property pathalias
- The alias to assign to the joined association (for later reference).
public Criteria createCriteria(String associationPath, String alias, int joinType)
Criteria
createCriteria
in interface Criteria
associationPath
- A dot-seperated property pathalias
- The alias to assign to the joined association (for later reference).joinType
- The type of join to use.
public ResultTransformer getResultTransformer()
public Criteria setResultTransformer(ResultTransformer tupleMapper)
Criteria
setResultTransformer
in interface Criteria
tupleMapper
- The transformer to apply
CriteriaSpecification.ROOT_ENTITY
,
CriteriaSpecification.DISTINCT_ROOT_ENTITY
,
CriteriaSpecification.ALIAS_TO_ENTITY_MAP
,
CriteriaSpecification.PROJECTION
public Integer getMaxResults()
public Criteria setMaxResults(int maxResults)
Criteria
setMaxResults
in interface Criteria
maxResults
- the maximum number of results
public Integer getFirstResult()
public Criteria setFirstResult(int firstResult)
Criteria
setFirstResult
in interface Criteria
firstResult
- the first result to retrieve, numbered from 0
public Integer getFetchSize()
public Criteria setFetchSize(int fetchSize)
Criteria
setFetchSize
in interface Criteria
fetchSize
- the fetch size
Statement.setFetchSize(int)
public Integer getTimeout()
public Criteria setTimeout(int timeout)
Criteria
setTimeout
in interface Criteria
timeout
- The timeout value to apply.
Statement.setQueryTimeout(int)
public boolean getCacheable()
public Criteria setCacheable(boolean cacheable)
Criteria
setCacheable
in interface Criteria
cacheable
- Should the result be considered cacheable; default is
to not cache (false).
public String getCacheRegion()
public Criteria setCacheRegion(String cacheRegion)
Criteria
setCacheRegion
in interface Criteria
cacheRegion
- the name of a query cache region, or null
for the default query cache
Criteria.setCacheable(boolean)
public String getComment()
public Criteria setComment(String comment)
Criteria
setComment
in interface Criteria
comment
- a human-readable string
public 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 List list() throws HibernateException
Criteria
list
in interface Criteria
HibernateException
public ScrollableResults scroll()
Criteria
ScrollableResults
scroll
in interface Criteria
ScrollableResults
representing the matched
query results.public ScrollableResults scroll(ScrollMode scrollMode)
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.public Object uniqueResult() throws HibernateException
Criteria
uniqueResult
in interface Criteria
HibernateException
- if there is more than one matching resultprotected void before()
protected void after()
public boolean isLookupByNaturalKey()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |