|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.dao.hibernate.GenericHibernateManualUpdateDao<T,ID>
public abstract class GenericHibernateManualUpdateDao<T,ID extends Serializable>
Implements the generic CRUD data access operations using Hibernate APIs.
The instances returned by this class do not automatically persist changes
to its state. The method update(Object, ITransaction)
must be
called to do it.
To write a DAO, subclass and parameterize this class with your persistent class. Of course, assuming that you have a traditional 1:1 approach for Entity:DAO design.
You have to inject the Class object of the persistent class to construct a DAO.
Constructor Summary | |
---|---|
protected |
GenericHibernateManualUpdateDao(Class<T> persistentClass)
|
Method Summary | |
---|---|
protected void |
add(T bean,
ITransaction transaction)
Adds the bean to the persistence layer. |
protected void |
addOrUpdate(T bean,
ITransaction transaction)
|
protected boolean |
delete(ID id,
ITransaction transaction)
Deletes the bean with the given id from persistence. |
protected void |
evict(ID id,
ITransaction transaction)
Evicts the bean with the given id from the second-level cache. |
protected List<T> |
findByCriteria(ITransaction transaction,
org.hibernate.criterion.Criterion... criterions)
Convenience method for subclasses. |
protected List<T> |
findByCriteria(ITransaction transaction,
org.hibernate.criterion.Criterion[] criterions,
org.hibernate.criterion.Order[] orders)
Convenience method for subclasses. |
protected T |
get(ID id,
ITransaction transaction)
Returns the bean with the given id. |
protected abstract ID |
getIdentifier(T bean)
|
protected Class<T> |
getPersistentClass()
Returns the class whose persistence this DAO controls. |
protected void |
setReadOnly(ITransaction transaction,
Collection<T> beans)
Sets a collection of beans to read-only state. |
protected void |
update(T bean,
ITransaction transaction)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected GenericHibernateManualUpdateDao(Class<T> persistentClass)
Method Detail |
---|
protected abstract ID getIdentifier(T bean)
protected Class<T> getPersistentClass()
protected T get(ID id, ITransaction transaction) throws PortalObjectNotFoundException, PortalException
id
- the bean's id.transaction
- the transaction for persistence access. Must be
a ITransactionHibernate
.
PortalObjectNotFoundException
- if the corresponding bean does not exist in the persistence.
PortalException
protected void add(T bean, ITransaction transaction) throws PortalException
bean
- the bean to be added.transaction
- the transaction for persistence access.
PortalException
protected void update(T bean, ITransaction transaction) throws PortalException
PortalException
protected void addOrUpdate(T bean, ITransaction transaction) throws PortalException
PortalException
protected boolean delete(ID id, ITransaction transaction) throws PortalException
id
- the bean's id.transaction
- the transaction for persistence access. Must be
a ITransactionHibernate
.
PortalException
protected void evict(ID id, ITransaction transaction) throws PortalException
id
- the bean identifier.transaction
- the transaction for persistence access.
PortalException
protected void setReadOnly(ITransaction transaction, Collection<T> beans) throws DaoException
DaoException
protected List<T> findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion[] criterions, org.hibernate.criterion.Order[] orders) throws DaoException
DaoException
protected List<T> findByCriteria(ITransaction transaction, org.hibernate.criterion.Criterion... criterions) throws DaoException
DaoException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |