Package lumis.portal.dao.hibernate
Class GenericHibernateDao<T,ID extends Serializable>
- java.lang.Object
-
- lumis.portal.dao.hibernate.GenericHibernateDao<T,ID>
-
public abstract class GenericHibernateDao<T,ID extends Serializable> extends Object
Implements the generic CRUD data access operations using Hibernate APIs.- Since:
- 4.0.11
- Version:
- $Revision: 7370 $ $Date: 2007-06-12 13:50:49 -0300 (Tue, 12 Jun 2007) $
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GenericHibernateDao(Class<T> persistentClass)
Create a new DAO instance for beans of the specified class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(T bean, ITransaction transaction)
Deletes the given bean from persistence.protected List<T>
findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion... criterions)
Utility find method for subclasses.protected List<T>
findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion[] criterions, org.hibernate.criterion.Order[] orders)
Utility find method for subclasses.T
get(ID id, ITransaction transaction)
Returns the bean with the given id.protected Class<T>
getPersistentClass()
Returns the class whose persistence this DAO controls.protected org.hibernate.Session
getSession(ITransaction transaction)
Returns the hibernate session associated with the given transaction.void
persist(T bean, ITransaction transaction)
Persists a transient bean, making it persistent.
-
-
-
Method Detail
-
getPersistentClass
protected Class<T> getPersistentClass()
Returns the class whose persistence this DAO controls.- Since:
- 4.0.11
-
getSession
protected org.hibernate.Session getSession(ITransaction transaction) throws PortalException
Returns the hibernate session associated with the given transaction.- Parameters:
transaction
- the transaction.- Returns:
- the session.
- Throws:
PortalException
- Since:
- 4.0.11
-
get
public T get(ID id, ITransaction transaction) throws PortalObjectNotFoundException, PortalException
Returns the bean with the given id.- Parameters:
id
- the bean's id.transaction
- the transaction for persistence access.- Returns:
- the bean.
- Throws:
PortalObjectNotFoundException
- if the corresponding bean does not exist in the persistence.PortalException
- Since:
- 4.0.11
-
persist
public void persist(T bean, ITransaction transaction) throws PortalException
Persists a transient bean, making it persistent.- Parameters:
bean
- the bean to be made persistent.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 4.0.11
-
delete
public void delete(T bean, ITransaction transaction) throws PortalException
Deletes the given bean from persistence.- Parameters:
bean
- the persistent bean.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 4.0.11
-
findByCriteria
protected List<T> findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion[] criterions, org.hibernate.criterion.Order[] orders) throws DaoException
Utility find method for subclasses.- Parameters:
transaction
- transaction for persistence access.criterions
- criterions used to find the result.orders
- specifies the order by which the results will be ordered.- Returns:
- a list with the beans found.
- Throws:
DaoException
- Since:
- 4.0.11
-
findByCriteria
protected List<T> findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion... criterions) throws DaoException
Utility find method for subclasses.- Parameters:
transaction
- transaction for persistence access.criterions
- criterions used to find the result.- Returns:
- a list with the beans found.
- Throws:
DaoException
- Since:
- 4.0.11
-
-