## org.hibernate.criterion
Class DetachedCriteria

    java.lang.Object
      org.hibernate.criterion.DetachedCriteria

All Implemented Interfaces:
  Serializable, CriteriaSpecification

    public class DetachedCriteria

extends Object
implements CriteriaSpecification, Serializable

Some applications need to create criteria queries in "detached mode", where the Hibernate session is not available. This class may be instantiated anywhere, and then a <literal>Criteria</literal> may be obtained by passing a session to <literal>getExecutableCriteria()</literal>. All methods have the same semantics and behavior as the corresponding methods of the <literal>Criteria</literal> interface.

See Also:
  `Criteria`, Serialized Form

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
`protected` `DetachedCriteria(CriteriaImpl impl, Criteria criteria)`
`protected` `DetachedCriteria(String entityName)`
`protected` `DetachedCriteria(String entityName, String alias)`

Method Summary
`DetachedCriteria` `add(Criterion criterion)`
`DetachedCriteria` `addOrder(Order order)`
`DetachedCriteria` `createAlias(String associationPath, String alias)`
`DetachedCriteria` `createAlias(String associationPath, String alias, int joinType)` Deprecated. use `createAlias(String, String, JoinType)`
`DetachedCriteria` `createAlias(String associationPath, String alias, int joinType, Criterion withClause)` Deprecated. use `createAlias(String, String, JoinType, Criterion)`
`DetachedCriteria` `createAlias(String associationPath, String alias, JoinType joinType)`
`DetachedCriteria` `createAlias(String associationPath, String alias, JoinType joinType, Criterion withClause)`
`DetachedCriteria` `createCriteria(String associationPath)`
`DetachedCriteria` `createCriteria(String associationPath, int joinType)` Deprecated. use `createCriteria(String, JoinType)`
`DetachedCriteria` `createCriteria(String associationPath, JoinType joinType)`
`DetachedCriteria` `createCriteria(String associationPath, String alias)`
`DetachedCriteria` `createCriteria(String associationPath, String alias, int joinType)` Deprecated. use `createCriteria(String, String, JoinType)`
`DetachedCriteria` `createCriteria(String associationPath, String alias, int joinType, Criterion withClause)` Deprecated. use `createCriteria(String, String, JoinType, Criterion)`
`DetachedCriteria` `createCriteria(String associationPath, String alias, JoinType joinType)`
`DetachedCriteria` `createCriteria(String associationPath, String alias, JoinType joinType, Criterion withClause)`
`static DetachedCriteria` `forClass(Class clazz)`
`static DetachedCriteria` `forClass(Class clazz, String alias)`
`static DetachedCriteria` `forEntityName(String entityName)`
`static DetachedCriteria` `forEntityName(String entityName, String alias)`
`String` `getAlias()`
`Criteria` `getExecutableCriteria(Session session)` Get an executable instance of <literal>Criteria</literal>, to actually run the query.
`DetachedCriteria` `setComment(String comment)`
`DetachedCriteria` `setFetchMode(String associationPath, FetchMode mode)`
`DetachedCriteria` `setLockMode(LockMode lockMode)`
`DetachedCriteria` `setLockMode(String alias, LockMode lockMode)`
`DetachedCriteria` `setProjection(Projection projection)`
`DetachedCriteria` `setResultTransformer(ResultTransformer resultTransformer)`
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DetachedCriteria

    protected DetachedCriteria(String entityName)

### DetachedCriteria

    protected DetachedCriteria(String entityName,
                               String alias)

### DetachedCriteria

    protected DetachedCriteria(CriteriaImpl impl,
                               Criteria criteria)

Method Detail

### getExecutableCriteria

    public Criteria getExecutableCriteria(Session session)

  Get an executable instance of <literal>Criteria</literal>, to actually run the query.

### forEntityName

    public static DetachedCriteria forEntityName(String entityName)

### forEntityName

    public static DetachedCriteria forEntityName(String entityName,
                                                 String alias)

### forClass

    public static DetachedCriteria forClass(Class clazz)

### forClass

    public static DetachedCriteria forClass(Class clazz,
                                            String alias)

### add

    public DetachedCriteria add(Criterion criterion)

### addOrder

    public DetachedCriteria addOrder(Order order)

### createAlias

    public DetachedCriteria createAlias(String associationPath,
                                        String alias)
                                 throws HibernateException

  Throws:
    `HibernateException`

### createCriteria

    public DetachedCriteria createCriteria(String associationPath,
                                           String alias)
                                    throws HibernateException

  Throws:
    `HibernateException`

### createCriteria

    public DetachedCriteria createCriteria(String associationPath)
                                    throws HibernateException

  Throws:
    `HibernateException`

### getAlias

    public String getAlias()

### setFetchMode

    public DetachedCriteria setFetchMode(String associationPath,
                                         FetchMode mode)
                                  throws HibernateException

  Throws:
    `HibernateException`

### setProjection

    public DetachedCriteria setProjection(Projection projection)

### setResultTransformer

    public DetachedCriteria setResultTransformer(ResultTransformer resultTransformer)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### createAlias

    public DetachedCriteria createAlias(String associationPath,
                                        String alias,
                                        JoinType joinType)
                                 throws HibernateException

  Throws:
    `HibernateException`

### createAlias

    public DetachedCriteria createAlias(String associationPath,
                                        String alias,
                                        JoinType joinType,
                                        Criterion withClause)
                                 throws HibernateException

  Throws:
    `HibernateException`

### createCriteria

    public DetachedCriteria createCriteria(String associationPath,
                                           JoinType joinType)
                                    throws HibernateException

  Throws:
    `HibernateException`

### createCriteria

    public DetachedCriteria createCriteria(String associationPath,
                                           String alias,
                                           JoinType joinType)
                                    throws HibernateException

  Throws:
    `HibernateException`

### createCriteria

    public DetachedCriteria createCriteria(String associationPath,
                                           String alias,
                                           JoinType joinType,
                                           Criterion withClause)
                                    throws HibernateException

  Throws:
    `HibernateException`

### createAlias

    @Deprecated
    public DetachedCriteria createAlias(String associationPath,
                                                   String alias,
                                                   int joinType)
                                 throws HibernateException

  Deprecated. use `createAlias(String, String, JoinType)`

  Throws:
    `HibernateException`

### createAlias

    @Deprecated
    public DetachedCriteria createAlias(String associationPath,
                                                   String alias,
                                                   int joinType,
                                                   Criterion withClause)
                                 throws HibernateException

  Deprecated. use `createAlias(String, String, JoinType, Criterion)`

  Throws:
    `HibernateException`

### createCriteria

    @Deprecated
    public DetachedCriteria createCriteria(String associationPath,
                                                      int joinType)
                                    throws HibernateException

  Deprecated. use `createCriteria(String, JoinType)`

  Throws:
    `HibernateException`

### createCriteria

    @Deprecated
    public DetachedCriteria createCriteria(String associationPath,
                                                      String alias,
                                                      int joinType)
                                    throws HibernateException

  Deprecated. use `createCriteria(String, String, JoinType)`

  Throws:
    `HibernateException`

### createCriteria

    @Deprecated
    public DetachedCriteria createCriteria(String associationPath,
                                                      String alias,
                                                      int joinType,
                                                      Criterion withClause)
                                    throws HibernateException

  Deprecated. use `createCriteria(String, String, JoinType, Criterion)`

  Throws:
    `HibernateException`

### setComment

    public DetachedCriteria setComment(String comment)

### setLockMode

    public DetachedCriteria setLockMode(LockMode lockMode)

### setLockMode

    public DetachedCriteria setLockMode(String alias,
                                        LockMode lockMode)

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.