Package lumis.portal.dao.hibernate
Class GenericHibernateDao<T,ID extends java.io.Serializable>
- java.lang.Object
-
- lumis.portal.dao.hibernate.GenericHibernateDao<T,ID>
-
public abstract class GenericHibernateDao<T,ID extends java.io.Serializable> extends java.lang.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(java.lang.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 java.util.List<T>
findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion... criterions)
Utility find method for subclasses.protected java.util.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 java.lang.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.
-
-
-
Constructor Detail
-
GenericHibernateDao
protected GenericHibernateDao(java.lang.Class<T> persistentClass)
Create a new DAO instance for beans of the specified class.- Parameters:
persistentClass
- the hibernate entity class.- Since:
- 4.0.11
-
-
Method Detail
-
getPersistentClass
protected java.lang.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 java.util.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 java.util.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
-
-