public class DetachedCriteria extends Object implements CriteriaSpecification, Serializable
     DetachedCriteria detached = new DetachedCriteria();
     ...
     Criteria criteria = detached.getExecutableCriteria( session );
     ...
     criteria.list();
 
 All methods have the same semantics and behavior as the corresponding methods of the Criteria interface.Criteria, 
Serialized FormALIAS_TO_ENTITY_MAP, DISTINCT_ROOT_ENTITY, FULL_JOIN, INNER_JOIN, LEFT_JOIN, PROJECTION, ROOT_ALIAS, ROOT_ENTITY| Modifier | Constructor and Description | 
|---|---|
protected  | 
DetachedCriteria(CriteriaImpl impl,
                Criteria criteria)  | 
protected  | 
DetachedCriteria(String entityName)  | 
protected  | 
DetachedCriteria(String entityName,
                String alias)  | 
| Modifier and Type | Method and Description | 
|---|---|
DetachedCriteria | 
add(Criterion criterion)
Add a restriction 
 | 
DetachedCriteria | 
addOrder(Order order)
Adds an ordering 
 | 
DetachedCriteria | 
createAlias(String associationPath,
           String alias)
Creates an association path alias within this DetachedCriteria. 
 | 
DetachedCriteria | 
createAlias(String associationPath,
           String alias,
           int joinType)
Deprecated. 
 
 | 
DetachedCriteria | 
createAlias(String associationPath,
           String alias,
           int joinType,
           Criterion withClause)
Deprecated. 
 
 | 
DetachedCriteria | 
createAlias(String associationPath,
           String alias,
           JoinType joinType)
Creates an association path alias within this DetachedCriteria specifying the type of join. 
 | 
DetachedCriteria | 
createAlias(String associationPath,
           String alias,
           JoinType joinType,
           Criterion withClause)
Creates an association path alias within this DetachedCriteria specifying the type of join. 
 | 
DetachedCriteria | 
createCriteria(String associationPath)
Creates an nested DetachedCriteria representing the association path. 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              int joinType)
Deprecated. 
 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              JoinType joinType)
Creates an nested DetachedCriteria representing the association path, specifying the type of join to use. 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              String alias)
Creates an nested DetachedCriteria representing the association path. 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              String alias,
              int joinType)
Deprecated. 
 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              String alias,
              int joinType,
              Criterion withClause)
Deprecated. 
 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              String alias,
              JoinType joinType)
Creates an nested DetachedCriteria representing the association path, specifying the type of join to use. 
 | 
DetachedCriteria | 
createCriteria(String associationPath,
              String alias,
              JoinType joinType,
              Criterion withClause)
Creates an nested DetachedCriteria representing the association path, specifying the type of join to use and
 an additional join restriction. 
 | 
static DetachedCriteria | 
forClass(Class clazz)
Static builder to create a DetachedCriteria for the given entity, by its Class. 
 | 
static DetachedCriteria | 
forClass(Class clazz,
        String alias)
Static builder to create a DetachedCriteria for the given entity, by its Class. 
 | 
static DetachedCriteria | 
forEntityName(String entityName)
Static builder to create a DetachedCriteria for the given entity. 
 | 
static DetachedCriteria | 
forEntityName(String entityName,
             String alias)
Static builder to create a DetachedCriteria for the given entity. 
 | 
String | 
getAlias()
Obtain the alias associated with this DetachedCriteria 
 | 
Criteria | 
getExecutableCriteria(Session session)
Get an executable instance of Criteria to actually run the query. 
 | 
DetachedCriteria | 
setComment(String comment)
Set the SQL comment to use. 
 | 
DetachedCriteria | 
setFetchMode(String associationPath,
            FetchMode mode)
Set the fetch mode for a given association 
 | 
DetachedCriteria | 
setLockMode(LockMode lockMode)
Set the lock mode to use. 
 | 
DetachedCriteria | 
setLockMode(String alias,
           LockMode lockMode)
Set an alias-specific lock mode. 
 | 
DetachedCriteria | 
setProjection(Projection projection)
Set the projection to use. 
 | 
DetachedCriteria | 
setResultTransformer(ResultTransformer resultTransformer)
Set the result transformer to use. 
 | 
String | 
toString()  | 
protected DetachedCriteria(String entityName)
protected DetachedCriteria(CriteriaImpl impl, Criteria criteria)
public Criteria getExecutableCriteria(Session session)
session - The session to associate the built Criteria withpublic String getAlias()
public static DetachedCriteria forEntityName(String entityName)
entityName - The name of the entity to create a DetachedCriteria forpublic static DetachedCriteria forEntityName(String entityName, String alias)
entityName - The name of the entity to create a DetachedCriteria foralias - The alias to apply to the entitypublic static DetachedCriteria forClass(Class clazz)
clazz - The entity classpublic static DetachedCriteria forClass(Class clazz, String alias)
clazz - The entity classalias - The alias to apply to the entitypublic DetachedCriteria add(Criterion criterion)
criterion - The restrictionthis, for method chainingpublic DetachedCriteria addOrder(Order order)
order - The orderingthis, for method chainingpublic DetachedCriteria setFetchMode(String associationPath, FetchMode mode)
associationPath - The association pathmode - The fetch mode to applythis, for method chainingpublic DetachedCriteria setProjection(Projection projection)
projection - The projection to usethis, for method chainingpublic DetachedCriteria setResultTransformer(ResultTransformer resultTransformer)
resultTransformer - The result transformer to usethis, for method chainingpublic DetachedCriteria createAlias(String associationPath, String alias)
associationPath - The association pathalias - The alias to apply to that association paththis, for method chainingpublic DetachedCriteria createAlias(String associationPath, String alias, JoinType joinType)
associationPath - The association pathalias - The alias to apply to that association pathjoinType - The type of join to usethis, for method chainingpublic DetachedCriteria createAlias(String associationPath, String alias, JoinType joinType, Criterion withClause)
associationPath - The association pathalias - The alias to apply to that association pathjoinType - The type of join to usewithClause - An additional restriction on the jointhis, for method chaining@Deprecated public DetachedCriteria createAlias(String associationPath, String alias, int joinType)
createAlias(String, String, JoinType)associationPath - The association pathalias - The alias to apply to that association pathjoinType - The type of join to usethis, for method chaining@Deprecated public DetachedCriteria createAlias(String associationPath, String alias, int joinType, Criterion withClause)
createAlias(String, String, JoinType, Criterion)associationPath - The association pathalias - The alias to apply to that association pathjoinType - The type of join to usewithClause - An additional restriction on the jointhis, for method chainingpublic DetachedCriteria createCriteria(String associationPath, String alias)
associationPath - The association pathalias - The alias to apply to that association pathpublic DetachedCriteria createCriteria(String associationPath)
associationPath - The association pathpublic DetachedCriteria createCriteria(String associationPath, JoinType joinType)
associationPath - The association pathjoinType - The type of join to usepublic DetachedCriteria createCriteria(String associationPath, String alias, JoinType joinType)
associationPath - The association pathalias - The alias to associate with this "join".joinType - The type of join to usepublic DetachedCriteria createCriteria(String associationPath, String alias, JoinType joinType, Criterion withClause)
associationPath - The association pathalias - The alias to associate with this "join".joinType - The type of join to usewithClause - The additional join restriction@Deprecated public DetachedCriteria createCriteria(String associationPath, int joinType)
createCriteria(String, JoinType)associationPath - The association pathjoinType - The type of join to use@Deprecated public DetachedCriteria createCriteria(String associationPath, String alias, int joinType)
createCriteria(String, String, JoinType)associationPath - The association pathalias - The aliasjoinType - The type of join to use@Deprecated public DetachedCriteria createCriteria(String associationPath, String alias, int joinType, Criterion withClause)
createCriteria(String, String, JoinType, Criterion)associationPath - The association pathalias - The alias to associate with this "join".joinType - The type of join to usewithClause - The additional join restrictionpublic DetachedCriteria setComment(String comment)
comment - The SQL comment to usethis, for method chainingpublic DetachedCriteria setLockMode(LockMode lockMode)
lockMode - The lock mode to usethis, for method chainingpublic DetachedCriteria setLockMode(String alias, LockMode lockMode)
alias - The alias to apply the lock tolockMode - The lock mode to use.this, for method chainingCopyright © 2001-2015 Red Hat, Inc. All Rights Reserved.