lumis.portal.dao.hibernate
Class GenericHibernateDao<T,ID extends Serializable>

Package class diagram package GenericHibernateDao
java.lang.Object
  extended by 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

Constructor Summary
protected GenericHibernateDao(Class<T> persistentClass)
          Create a new DAO instance for beans of the specified class.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericHibernateDao

protected GenericHibernateDao(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 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


Lumisportal  4.1.0.071221 - Copyright © 2001-2007, Lumis. All Rights Reserved.