|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.riotfamily.riot.hibernate.support.HibernateSupport org.riotfamily.riot.hibernate.support.HibernateHelper
public class HibernateHelper
Class that provides helper methods to work with contextual sessions. All HibernateExceptions are caught and converted to DataAccessExceptions.
Constructor Summary | |
---|---|
HibernateHelper(org.hibernate.SessionFactory sessionFactory)
|
|
HibernateHelper(org.hibernate.SessionFactory sessionFactory,
String defaultCacheReqion)
|
Method Summary | ||
---|---|---|
org.hibernate.Criteria |
createCacheableCriteria(Class<?> clazz)
Creates a cacheable Criteria for the given Class, using the helper's defaultCacheRegion. |
|
org.hibernate.Criteria |
createCacheableCriteria(String cacheRegion,
Class<?> clazz)
Creates a cacheable Criteria for the given Class, using the specified cache region. |
|
org.hibernate.Query |
createCacheableQuery(String hql)
Creates a cacheable Query for the given HQL, using the helper's defaultCacheRegion. |
|
org.hibernate.Query |
createCacheableQuery(String cacheRegion,
String hql)
Creates a cacheable Query for the given HQL, using the specified cache region. |
|
org.hibernate.Criteria |
createCriteria(Class<?> clazz)
Creates a Criteria for the given Class. |
|
org.hibernate.Query |
createFilter(Object object,
String hql)
Creates filter for the given object. |
|
org.hibernate.Query |
createQuery(String hql)
Creates Query for the given HQL. |
|
void |
delete(Object object)
Deletes the given persistent instance. |
|
void |
evict(Object object)
Remove this instance from the session cache. |
|
int |
executeUpdate(org.hibernate.Query query)
|
|
void |
flush()
Forces the current session to flush. |
|
|
get(Class<T> clazz,
Serializable id)
Returns the persistent instance of the given Class, or null
if no such instance exists. |
|
org.hibernate.Session |
getSession()
Returns the current session. |
|
|
list(org.hibernate.Criteria c)
|
|
|
list(org.hibernate.Query query)
|
|
|
load(Class<T> clazz,
Serializable id)
Returns the persistent instance of the given Class, assuming that the instance exists. |
|
void |
lock(Object object,
org.hibernate.LockMode lockMode)
Obtain the specified lock leve upon the given object. |
|
|
merge(T object)
Merges the given detached instance. |
|
void |
persist(Object object)
Persists the given transient instance. |
|
|
reattach(T object)
Re-attaches the given instance. |
|
void |
refresh(Object object)
Re-reads the state of the given persistent or detached instance. |
|
Serializable |
save(Object object)
Persists the given transient instance. |
|
void |
saveOrUpdate(Object object)
Either saves or updates the given instance, depending upon resolution of the unsaved-value checks. |
|
void |
setParameter(org.hibernate.Query query,
String name,
Object val)
|
|
|
uniqueResult(org.hibernate.Criteria c)
|
|
|
uniqueResult(org.hibernate.Query query)
|
|
void |
update(Object object)
Updates the given persistent instance. |
Methods inherited from class org.riotfamily.riot.hibernate.support.HibernateSupport |
---|
getSessionFactory, setSessionFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HibernateHelper(org.hibernate.SessionFactory sessionFactory)
public HibernateHelper(org.hibernate.SessionFactory sessionFactory, String defaultCacheReqion)
Method Detail |
---|
public org.hibernate.Session getSession()
getSession
in class HibernateSupport
SessionFactory.getCurrentSession()
public org.hibernate.Criteria createCriteria(Class<?> clazz)
createCriteria
in class HibernateSupport
public org.hibernate.Criteria createCacheableCriteria(Class<?> clazz)
public org.hibernate.Criteria createCacheableCriteria(String cacheRegion, Class<?> clazz)
public org.hibernate.Query createQuery(String hql)
createQuery
in class HibernateSupport
public org.hibernate.Query createCacheableQuery(String hql)
public org.hibernate.Query createCacheableQuery(String cacheRegion, String hql)
public org.hibernate.Query createFilter(Object object, String hql)
createFilter
in class HibernateSupport
public <T> T load(Class<T> clazz, Serializable id) throws DataAccessException
DataAccessException
Session.load(Class, Serializable)
public <T> T get(Class<T> clazz, Serializable id) throws DataAccessException
null
if no such instance exists.
DataAccessException
Session.get(Class, Serializable)
public Serializable save(Object object) throws DataAccessException
DataAccessException
Session.save(Object)
public void persist(Object object) throws DataAccessException
DataAccessException
Session.persist(Object)
public void saveOrUpdate(Object object) throws DataAccessException
DataAccessException
public void update(Object object) throws DataAccessException
DataAccessException
Session.update(Object)
public <T> T merge(T object) throws DataAccessException
DataAccessException
Session.merge(Object)
public <T> T reattach(T object) throws DataAccessException
DataAccessException
public void lock(Object object, org.hibernate.LockMode lockMode) throws DataAccessException
DataAccessException
Session.lock(Object, LockMode)
public void delete(Object object) throws DataAccessException
DataAccessException
Session.delete(Object)
public void refresh(Object object) throws DataAccessException
DataAccessException
Session.refresh(Object)
public void flush() throws DataAccessException
DataAccessException
Session.flush()
public void evict(Object object) throws DataAccessException
DataAccessException
Session.evict(Object)
public <T> List<T> list(org.hibernate.Query query) throws DataAccessException
DataAccessException
public <T> T uniqueResult(org.hibernate.Query query) throws DataAccessException
DataAccessException
public <T> List<T> list(org.hibernate.Criteria c) throws DataAccessException
DataAccessException
public <T> T uniqueResult(org.hibernate.Criteria c) throws DataAccessException
DataAccessException
public void setParameter(org.hibernate.Query query, String name, Object val)
public int executeUpdate(org.hibernate.Query query)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |