org.perfectjpattern.jee.integration.dao
Class HibernateGenericDao<Id extends Serializable,Element>
java.lang.Object
org.perfectjpattern.jee.integration.dao.JpaBaseDao<Id,Element>
org.perfectjpattern.jee.integration.dao.HibernateGenericDao<Id,Element>
- Type Parameters:
Id
- Identification typeElement
- Element type
- All Implemented Interfaces:
- IBaseDao<Id,Element>, IBaseReadOnlyDao<Id,Element>, IGenericDao<Id,Element>, IGenericReadOnlyDao<Id,Element>
- Direct Known Subclasses:
- AbstractHibernateManagedGenericDao, SpringGenericDao
public class HibernateGenericDao<Id extends Serializable,Element>
- extends JpaBaseDao<Id,Element>
- implements IGenericDao<Id,Element>
Hibernate-based implementation of IGenericReadOnlyDao
- Version:
- $Revision: 1.0 $ $Date: Nov 26, 2007 9:15:14 PM $
- Author:
- Giovanni Azua
-
-
Methods inherited from class org.perfectjpattern.jee.integration.dao.JpaBaseDao |
contains, count, create, delete, deleteAll, findAll, findById, getPersistentClass, getSession, getSessionStrategy, getTransaction, getTransactionStrategy, setEntityManager, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HibernateGenericDao
protected HibernateGenericDao(Class<Element> aPersistentClass,
ISessionStrategy aSessionStrategy,
ITransactionStrategy aTransactionStrategy)
throws IllegalArgumentException
- Constructs a
HibernateGenericDao
instance from the
persistent class type, the ISessionStrategy
that creates
Session
instances and the ITransactionStrategy
that
creates Transaction
instances
- Parameters:
aPersistentClass
- The persistent Java Bean classaSessionStrategy
- Factory that creates SessionsaTransactionStrategy
- Factory that creates Transaction
- Throws:
IllegalArgumentException
findByExample
public List<Element> findByExample(Element anElement,
String... anExcludeProperties)
throws DaoException,
IllegalArgumentException
- Returns the List of Elements that match the search criteria specified
through the Example. Searches all Elements that match the properties set
in the Example Element.
- Specified by:
findByExample
in interface IGenericReadOnlyDao<Id extends Serializable,Element>
- Parameters:
anElement
- Example Element to search for.anExcludeProperties
- Array of Java Bean property names to exclude
- Returns:
- List of Elements that match the search criteria specified
through all properties set in the Example.
- Throws:
DaoException
IllegalArgumentException
- 'anId' must not be null
getActualSession
protected org.hibernate.Session getActualSession()
throws DaoException
- Returns the Session
- Returns:
- the Session
- Throws:
DaoException
Copyright © 2007-2009. All Rights Reserved.