org.hibernate.criterion
Class DetachedCriteria

java.lang.Object
  extended by 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 Criteria may be obtained by passing a session to getExecutableCriteria(). All methods have the same semantics and behavior as the corresponding methods of the Criteria interface.

Author:
Gavin King
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)
           
 DetachedCriteria createCriteria(String associationPath)
           
 DetachedCriteria createCriteria(String associationPath, int joinType)
           
 DetachedCriteria createCriteria(String associationPath, String alias)
           
 DetachedCriteria createCriteria(String associationPath, String alias, int joinType)
           
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 Criteria, 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 Criteria, 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,
                                    int joinType)
                             throws HibernateException
Throws:
HibernateException

createCriteria

public DetachedCriteria createCriteria(String associationPath,
                                       int joinType)
                                throws HibernateException
Throws:
HibernateException

createCriteria

public DetachedCriteria createCriteria(String associationPath,
                                       String alias,
                                       int joinType)
                                throws HibernateException
Throws:
HibernateException

setComment

public DetachedCriteria setComment(String comment)

setLockMode

public DetachedCriteria setLockMode(LockMode lockMode)

setLockMode

public DetachedCriteria setLockMode(String alias,
                                    LockMode lockMode)