public abstract class GenericHibernateManualUpdateDao<T,ID extends Serializable> extends Object
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.
Modifier | Constructor and Description |
---|---|
protected |
GenericHibernateManualUpdateDao(Class<T> persistentClass) |
Modifier and Type | Method and Description |
---|---|
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 boolean |
exists(ID id,
ITransaction transaction)
Returns whether the bean of identifier
id exists. |
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) |
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 boolean exists(ID id, ITransaction transaction) throws PortalException
id
exists.id
- the bean identifier.transaction
- the transacion to be used.id
exists.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
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.