Class GenericHibernateDao<T,​ID extends Serializable>


  • 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 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
      • 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