|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the domain object typeID
- the id of the domain object to findpublic interface ConvenienceGenericHibernateDao<T,ID extends Serializable>
This interface extends ConvenienceGenericDao
with query methods using
DetachedCriteria
s.
Method Summary | |
---|---|
void |
deleteAllNoCascade()
Deletes all available T using a HQL query. |
void |
deleteNoCascade(Collection<T> entities)
Deletes the given domain objects using a HQL query. |
List<T> |
findByCriteria(DetachedCriteria hibernateCriteria)
Retrieves all the domain objects matching the Hibernate criteria. |
List<T> |
findByCriteria(DetachedCriteria hibernateCriteria,
DataExtent extent)
Retrieves all the domain objects matching the Hibernate criteria. |
List<T> |
findByCriteria(DetachedCriteria hibernateCriteria,
int firstResult,
int maxResults)
Retrieves a range of domain objects matching the Hibernate criteria. |
List<T> |
findByCriteria(DetachedCriteria hibernateCriteria,
int firstResult,
int maxResults,
DataExtent extent)
Retrieves a range of domain objects matching the Hibernate criteria. |
T |
findById(ID id,
boolean lock,
DataExtent extent)
Retrieves a domain object by identifier, optionally obtaining a database lock for this operation. |
T |
findById(ID id,
DataExtent extent)
Retrieves a domain object by identifier. |
List<T> |
findByQuery(QueryObject q,
DataExtent extent)
Executes a query based on a given query object. |
int |
findCountByCriteria(DetachedCriteria hibernateCriteria)
Retrieves the number of domain objects matching the Hibernate criteria. |
List<T> |
getAll(DataExtent extent)
Retrieves all the domain objects of type T. |
Order[] |
getDefaultOrder()
|
DetachedCriteria |
getOrderedCriteria()
Create a DetachedCriteria what contains default ordering and distinct constraints. |
T |
refresh(T entity,
DataExtent extent)
Re-reads the state of the given domain object from the underlying store. |
T |
reload(T entity,
DataExtent extent)
Re-reads the state of the given domain object from the undermost store (eg. the database). |
T |
saveOrUpdateAndFlush(T entity)
Convenience method: Executes saveOrUpdate() and flush() on that entity. |
void |
setDefaultOrder(Order... defaultOrder)
Set default order of results returned by getAll and findByQuery (not findByCriteria!). |
Methods inherited from interface ch.elca.el4j.services.persistence.generic.dao.ConvenienceGenericDao |
---|
delete, delete, deleteAll, deleteById, findById, findByIdLazy, flush, getAll |
Methods inherited from interface ch.elca.el4j.services.persistence.generic.dao.GenericDao |
---|
delete, findByQuery, findCountByQuery, getPersistentClass, refresh, reload, saveOrUpdate, setPersistentClass |
Method Detail |
---|
T saveOrUpdateAndFlush(T entity) throws DataAccessException, DataIntegrityViolationException, OptimisticLockingFailureException
entity
- The domain object to save or update
DataAccessException
DataIntegrityViolationException
OptimisticLockingFailureException
void deleteAllNoCascade() throws OptimisticLockingFailureException, DataAccessException
T
using a HQL query.
This has the benefit of a significant performance improvement
in comparison to deleteAll
. The tradeoff is that this
method does no cascade deletion.
OptimisticLockingFailureException
- If domain object has been modified/deleted in the meantime
DataAccessException
- If general data access problem occurredvoid deleteNoCascade(Collection<T> entities) throws DataAccessException, DataIntegrityViolationException, OptimisticLockingFailureException
delete
. The tradeoff is that this
method does no cascade deletion.
entities
- The domain objects to delete.
OptimisticLockingFailureException
- If domain object has been modified/deleted in the meantime
DataAccessException
- If general data access problem occurred
DataIntegrityViolationException
List<T> findByCriteria(DetachedCriteria hibernateCriteria) throws DataAccessException
hibernateCriteria
- the criteria that the result has to fulfill
Note: Do not reuse criteria objects! They need to recreated
(or cloned e.g. using SerializationUtils.clone()) per execution,
due to the suboptimal design of Hibernate's criteria facility.
DataAccessException
HibernateTemplate.findByCriteria(DetachedCriteria)
List<T> findByCriteria(DetachedCriteria hibernateCriteria, DataExtent extent) throws DataAccessException
hibernateCriteria
- the criteria that the result has to fulfill
Note: Do not reuse criteria objects! They need to recreated
(or cloned e.g. using SerializationUtils.clone()) per execution,
due to the suboptimal design of Hibernate's criteria facility.extent
- the extent in which objects get loaded.
DataAccessException
HibernateTemplate.findByCriteria(DetachedCriteria)
List<T> findByCriteria(DetachedCriteria hibernateCriteria, int firstResult, int maxResults) throws DataAccessException
hibernateCriteria
- the criteria that the result has to fulfill
Note: Do not reuse criteria objects! They need to recreated
(or cloned e.g. using SerializationUtils.clone()) per execution,
due to the suboptimal design of Hibernate's criteria facility.firstResult
- the index of the first result to returnmaxResults
- the maximum number of results to return
DataAccessException
HibernateTemplate.findByCriteria(DetachedCriteria, int, int)
List<T> findByCriteria(DetachedCriteria hibernateCriteria, int firstResult, int maxResults, DataExtent extent) throws DataAccessException
hibernateCriteria
- the criteria that the result has to fulfill
Note: Do not reuse criteria objects! They need to recreated
(or cloned e.g. using SerializationUtils.clone()) per execution,
due to the suboptimal design of Hibernate's criteria facility.firstResult
- the index of the first result to returnmaxResults
- the maximum number of results to returnextent
- the extent in which objects get loaded.
DataAccessException
HibernateTemplate.findByCriteria(DetachedCriteria, int, int)
int findCountByCriteria(DetachedCriteria hibernateCriteria) throws DataAccessException
hibernateCriteria
- the criteria that the result has to fulfill
Note: Do not reuse criteria objects! They need to recreated
(or cloned e.g. using SerializationUtils.clone()) per execution,
due to the suboptimal design of Hibernate's criteria facility.
DataAccessException
ConvenienceHibernateTemplate.findCountByCriteria(DetachedCriteria)
T findById(ID id, DataExtent extent) throws DataRetrievalFailureException, DataAccessException
id
- The id of the domain object to findextent
- the extent in which objects get loaded.
DataRetrievalFailureException
- If no domain object could be found with given id.
DataAccessException
- If general data access problem occurredT findById(ID id, boolean lock, DataExtent extent) throws DataAccessException, DataRetrievalFailureException
id
- The id of a domain objectlock
- Indicates whether a database lock should be obtained for this
operationextent
- the extent in which objects get loaded.
DataAccessException
- If general data access problem occurred
DataRetrievalFailureException
- If domain object could not be retrievedList<T> getAll(DataExtent extent) throws DataAccessException
extent
- the extent in which objects get loaded.
DataAccessException
- If general data access problem occurredList<T> findByQuery(QueryObject q, DataExtent extent) throws DataAccessException
q
- The search query objectextent
- the extent in which objects get loaded.
DataAccessException
- If general data access problem occurredT refresh(T entity, DataExtent extent) throws DataAccessException, DataRetrievalFailureException
entity
- The domain object to re-read the state ofextent
- the extent in which objects get loaded.
DataAccessException
- If general data access problem occurred
DataRetrievalFailureException
- If domain object could not be re-readT reload(T entity, DataExtent extent) throws DataAccessException, DataRetrievalFailureException
entity
- The domain object to re-read the state ofextent
- the extent in which objects get loaded.
DataAccessException
- If general data access problem occurred
DataRetrievalFailureException
- If domain object could not be re-readOrder[] getDefaultOrder()
Order
to order the resultsvoid setDefaultOrder(Order... defaultOrder)
null
then default ordering is deactivated.
defaultOrder
- the default Order
to order the resultsDetachedCriteria getOrderedCriteria()
DetachedCriteria
what contains default ordering and distinct constraints.
DetachedCriteria
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |