|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The generic type of the domain class the DAO is responsible forpublic interface GenericDao<T>
Interface for generic DAOs. It is the interface that implements the DDD-Book's (http://www.domaindrivendesign.org/) Repository pattern. This interface is implemented generically and it can be extended in case you need more specific methods. Based on an idea from the Hibernate website. This is the canonical form of this interface. We recommend it when a generic DAO is used in tools (to make the contract minimal). For direct programmer-usage we recommend to use the convenience subclasses (@link ConvenienceGenericDao).
Method Summary | |
---|---|
void |
delete(Collection<T> entities)
Deletes the given domain objects. |
List<T> |
findByQuery(QueryObject q)
Executes a query based on a given query object. |
int |
findCountByQuery(QueryObject query)
Count number of results of a search. |
Class<T> |
getPersistentClass()
Needed because the Java generics throw away this type information. |
T |
refresh(T entity)
Re-reads the state of the given domain object from the underlying store. |
T |
reload(T entity)
Re-reads the state of the given domain object from the undermost store (eg. the database). |
T |
saveOrUpdate(T entity)
Saves or updates the given domain object. |
void |
setPersistentClass(Class<T> c)
New: this callback is in general no longer required (the constructor should figure the type out itself). |
Method Detail |
---|
Class<T> getPersistentClass()
void setPersistentClass(Class<T> c)
c
- Mandatory. The domain class this DAO is responsible for.List<T> findByQuery(QueryObject q) throws DataAccessException
q
- The search query object
DataAccessException
- If general data access problem occurredint findCountByQuery(QueryObject query) throws DataAccessException
query
- The search query object
DataAccessException
T refresh(T entity) throws DataAccessException, DataRetrievalFailureException
entity
- The domain object to re-read the state of
DataAccessException
- If general data access problem occurred
DataRetrievalFailureException
- If domain object could not be re-readT reload(T entity) throws DataAccessException, DataRetrievalFailureException
entity
- The domain object to re-load the state of
DataAccessException
- If general data access problem occurred
DataRetrievalFailureException
- If domain object could not be re-loadedT saveOrUpdate(T entity) throws DataAccessException, DataIntegrityViolationException, OptimisticLockingFailureException
entity
- The domain object to save or update
DataAccessException
- If general data access problem occurred
DataIntegrityViolationException
- If domain object could not be inserted due to a data
integrity violation
OptimisticLockingFailureException
- If domain object has been modified/deleted in the meantimevoid delete(Collection<T> entities) throws OptimisticLockingFailureException, DataAccessException
entities
- The domain objects to delete.
DataAccessException
- If general data access problem occurred
OptimisticLockingFailureException
- If domain object has been modified/deleted in the meantime
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |