|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
T - a type variablePK - the primary key for that typepublic interface GenericORMDAO<T,PK extends java.io.Serializable>
Generic DAO (Data Access Object) with common methods to CRUD POJOs.
Extend this interface if you want typesafe (no casting necessary) DAO's for your domain objects.
| Method Summary | |
|---|---|
int |
count(com.trg.search.IMutableSearch search)
Returns the total number of results that would be returned using the given ISearch if there were no paging or maxResult limits. |
boolean |
exists(PK id)
Checks for existence of an object of type T using the id arg. |
java.util.List<T> |
findByNamedQuery(java.lang.String queryName,
java.util.Map<java.lang.String,java.lang.Object> queryParams)
Find a list of records by using a named query |
T |
get(PK id)
Return the persistent instance of an entity with the given identifier, or null if not found. |
java.util.List<T> |
getAll()
Generic method used to get all objects of a particular type. |
java.util.List<T> |
getAll(java.util.List<PK> ids)
Retrieve a List of entities matching given ids |
java.util.List<T> |
getAll(java.util.List<PK> ids,
RequestOptions requestOptions)
Retrieve a List of entities matching given ids, sorted and
paginated according to the given request options |
java.util.List<T> |
getAll(RequestOptions requestOptionsTO)
Generic method used to get all objects of a particular type, sorted and paginated according to the given request options. |
java.util.List<T> |
getAllDistinct()
Gets all records without duplicates. |
org.hibernate.search.FullTextSession |
getFullTextSession()
Return the FullTextSession associated to the current
Session |
java.lang.Class<T> |
getManipulatedType()
Return the type of entity manipulated by this DAO |
void |
remove(PK id)
Generic method to delete an object based on class and id |
void |
remove(T object)
Generic method to delete an object |
void |
removeAll(java.util.List<T> objects)
Generic method to delete a list of objects |
T |
save(T object)
Generic method to save an object - handles both update and insert. |
java.util.List<T> |
search(com.trg.search.IMutableSearch search)
Search for objects based on the search parameters in the specified ISearch object. |
com.trg.search.SearchResult<T> |
searchAndCount(com.trg.search.IMutableSearch search)
Returns a SearchResult object that includes the list of
results like search() and the total length like
searchLength. |
java.util.List<T> |
searchEquals(java.lang.String[] criteria,
java.lang.String[] properties,
RequestOptions requestOptionsTO)
This method allows to search Objects on String properties, fitting search criteria. |
java.util.List<T> |
searchLike(java.lang.String[] criteria,
java.lang.String[] properties,
RequestOptions requestOptionsTO)
This method allows to search Objects on String properties, fitting search criteria. |
java.util.List<T> |
searchLucene(java.lang.String[] criteria,
java.lang.String[] searchedProperties)
This method allows to search Objects on String properties, fitting search criteria. |
java.util.List<T> |
searchLucene(java.lang.String[] criteria,
java.lang.String[] searchedProperties,
RequestOptions requestOptions)
This method allows to search Objects on String properties, fitting search criteria. |
T |
searchUnique(com.trg.search.IMutableSearch search)
Search for a single result using the given parameters. |
| Method Detail |
|---|
java.util.List<T> getAll(RequestOptions requestOptionsTO)
requestOptionsTO - include sort order and pagination information
java.util.List<T> getAll()
T get(PK id)
null if not found.
id - the identifier of the persistent instance
null if not found
org.springframework.dao.DataAccessException - in case of Hibernate errorsSession.get(Class, java.io.Serializable)boolean exists(PK id)
id - the id of the entity
@Transactional T save(T object)
object - the object to save
void remove(PK id)
id - the identifier (primary key) of the object to removevoid remove(T object)
object - the object to removevoid removeAll(java.util.List<T> objects)
objects - the object list to removejava.util.List<T> getAllDistinct()
Note that if you use this method, it is imperative that your model classes correctly implement the hashcode/equals methods
java.util.List<T> findByNamedQuery(java.lang.String queryName,
java.util.Map<java.lang.String,java.lang.Object> queryParams)
queryName - query name of the named queryqueryParams - a map of the query names and the values
java.lang.Class<T> getManipulatedType()
Class of the manipulated entityjava.util.List<T> getAll(java.util.List<PK> ids)
List of entities matching given ids
ids - a List of ids
List of entities matching ids, must be non null, could
be empty
java.util.List<T> getAll(java.util.List<PK> ids,
RequestOptions requestOptions)
List of entities matching given ids, sorted and
paginated according to the given request options
ids - a List of idsrequestOptions - include sort order and pagination information
List of entities matching ids, must be
non null, could be emptyjava.util.List<T> search(com.trg.search.IMutableSearch search)
ISearch object.
ISearchint count(com.trg.search.IMutableSearch search)
ISearch if there were no paging or maxResult limits.
ISearchcom.trg.search.SearchResult<T> searchAndCount(com.trg.search.IMutableSearch search)
SearchResult object that includes the list of
results like search() and the total length like
searchLength.
ISearch
T searchUnique(com.trg.search.IMutableSearch search)
throws org.hibernate.NonUniqueResultException
org.hibernate.NonUniqueResultException
java.util.List<T> searchLike(java.lang.String[] criteria,
java.lang.String[] properties,
RequestOptions requestOptionsTO)
criteria - the search criteriaproperties - the searched propertiesrequestOptionsTO - include sort order and pagination information
java.util.List<T> searchEquals(java.lang.String[] criteria,
java.lang.String[] properties,
RequestOptions requestOptionsTO)
criteria - the search criteriaproperties - the searched propertiesrequestOptionsTO - include sort order and pagination information
java.util.List<T> searchLucene(java.lang.String[] criteria,
java.lang.String[] searchedProperties)
throws DAOLayerException
List of entity managed by the ORM
engine (Hibernate). All ORM managed attributes of these entities are
populated.
criteria - the search criteriaproperties - the searched properties
List of entity managed by the ORM engine.
DAOLayerException - if criteria or searchedProperties are empty
java.util.List<T> searchLucene(java.lang.String[] criteria,
java.lang.String[] searchedProperties,
RequestOptions requestOptions)
throws DAOLayerException
List of entity managed by the ORM
engine (Hibernate), sorted and paginated according to the given request
options. All ORM managed attributes of these entities are populated.
criteria - the search criteriaproperties - the searched propertiesrequestOptions - include sort order and pagination information, could be null
List of entity managed by the ORM engine.
DAOLayerException - if criteria or searchedProperties are emptyorg.hibernate.search.FullTextSession getFullTextSession()
FullTextSession associated to the current
Session
FullTextSession associated to the current
Session
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||