T - The type of the domain object for which this instance is to be
used.ID - The type of the id of the domain object for which this instance is
to be used.public class GenericDAOImpl<T,ID extends Serializable> extends HibernateBaseDAO implements GenericDAO<T,ID>
GenericDAO using Hibernate.
The SessionFactory property is annotated for automatic resource injection.| Modifier and Type | Field and Description |
|---|---|
protected Class<T> |
persistentClass |
| Constructor and Description |
|---|
GenericDAOImpl() |
| Modifier and Type | Method and Description |
|---|---|
int |
count(ISearch search)
Returns the total number of results that would be returned using the
given
ISearch if there were no paging or maxResult limits. |
void |
create(T object)
Add the specified object as a new entry in the datastore.
|
boolean |
createOrUpdate(T object)
If the id of the object is null or zero, create, otherwise update.
|
boolean |
deleteById(ID id)
Remove the object of this type with the specified id from the datastore.
|
boolean |
deleteEntity(T object)
Remove the specified object from the datastore.
|
T |
fetch(ID id)
Get the object of this type with the specified id from the datastore.
|
List<T> |
fetchAll()
Get a list of all the objects of this type.
|
void |
flush()
Flushes changes in the Hibernate cache to the datastore.
|
Filter |
getFilterFromExample(T example)
Generates a search filter from the given example using default options.
|
Filter |
getFilterFromExample(T example,
ExampleOptions options)
Generates a search filter from the given example using the specified options.
|
boolean |
isConnected(Object object)
Returns true if the object is connected to the current Hibernate session.
|
void |
refresh(Object object)
Refresh the content of the given entity from the current datastore state.
|
List<T> |
search(ISearch search)
Search for objects of this type given the search parameters in the
specified
ISearch object. |
SearchResult<T> |
searchAndCount(ISearch search)
Returns a
SearchResult object that includes the list of
results like search() and the total length like
searchLength. |
List |
searchGeneric(ISearch search)
Search for objects given the search parameters in the specified
ISearch object. |
Object |
searchUnique(ISearch search)
Search for a single result using the given parameters.
|
void |
update(T object)
Update the corresponding object in the datastore with the properties of
the specified object.
|
_all, _count, _count, _count, _deleteById, _deleteById, _deleteEntities, _deleteEntity, _exists, _exists, _exists, _flush, _get, _get, _getFilterFromExample, _getFilterFromExample, _load, _load, _load, _merge, _persist, _refresh, _save, _save, _saveOrUpdate, _saveOrUpdateIsNew, _saveOrUpdateIsNew, _search, _search, _searchAndCount, _searchAndCount, _searchUnique, _searchUnique, _sessionContains, _update, getMetadataUtil, getSearchProcessor, getSession, getSessionFactory, setSessionFactorypublic void create(T object)
GenericDAOcreate in interface GenericDAO<T,ID extends Serializable>public boolean createOrUpdate(T object)
GenericDAOcreateOrUpdate in interface GenericDAO<T,ID extends Serializable>true if create; false if update.public boolean deleteById(ID id)
GenericDAOdeleteById in interface GenericDAO<T,ID extends Serializable>true if the object is found in the datastore and
removed, false if the item is not found.public boolean deleteEntity(T object)
GenericDAOdeleteEntity in interface GenericDAO<T,ID extends Serializable>true if the object is found in the datastore and
removed, false if the item is not found.public T fetch(ID id)
GenericDAOfetch in interface GenericDAO<T,ID extends Serializable>public List<T> fetchAll()
GenericDAOfetchAll in interface GenericDAO<T,ID extends Serializable>public void update(T object)
GenericDAOupdate in interface GenericDAO<T,ID extends Serializable>public List<T> search(ISearch search)
GenericDAOISearch object.search in interface GenericDAO<T,ID extends Serializable>public int count(ISearch search)
GenericDAOISearch if there were no paging or maxResult limits.count in interface GenericDAO<T,ID extends Serializable>public SearchResult<T> searchAndCount(ISearch search)
GenericDAOSearchResult object that includes the list of
results like search() and the total length like
searchLength.searchAndCount in interface GenericDAO<T,ID extends Serializable>public boolean isConnected(Object object)
GenericDAOisConnected in interface GenericDAO<T,ID extends Serializable>public void flush()
GenericDAOflush in interface GenericDAO<T,ID extends Serializable>public void refresh(Object object)
GenericDAOrefresh in interface GenericDAO<T,ID extends Serializable>public List searchGeneric(ISearch search)
GenericDAOISearch object. Return an untyped result list. The result
type can be determined by fetch mode and fetches on the search.searchGeneric in interface GenericDAO<T,ID extends Serializable>public Object searchUnique(ISearch search) throws org.hibernate.NonUniqueResultException
GenericDAOsearchUnique in interface GenericDAO<T,ID extends Serializable>org.hibernate.NonUniqueResultExceptionpublic Filter getFilterFromExample(T example)
GenericDAOgetFilterFromExample in interface GenericDAO<T,ID extends Serializable>public Filter getFilterFromExample(T example, ExampleOptions options)
GenericDAOgetFilterFromExample in interface GenericDAO<T,ID extends Serializable>Copyright © 2008-2013. All Rights Reserved.