public class GenericDao<T,PK extends Serializable> extends org.springframework.orm.hibernate3.support.HibernateDaoSupport implements IDao<T,PK>
| Modifier and Type | Field and Description |
|---|---|
protected Class<T> |
persistentClass |
| Constructor and Description |
|---|
GenericDao(Class<T> persistentClass)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
long |
count() |
int |
deleteAll()
Delete all the object from the datastore
|
void |
deleteAll(List<T> list)
Delete all the specified object from the datastore
|
boolean |
exists(PK id)
Checks for existence of an object of type T using the id arg.
|
void |
flushAndClear()
Flush all Memory Objects to the database, and clear the L1 cache, of the
current thread-bound Hibernate Session.
|
T |
get(PK id)
Retrieve the Object whith the specified primary key
|
List<T> |
getAll()
Generic method used to get all objects of a particular type.
|
List<T> |
getAllPaginate(int from,
int maxResults)
Returns all object of a particular type (i.e getAllPaginate(2,5) will
return the [2,3,4,5,6] object
|
Class<T> |
getPersistenceClass() |
void |
remove(T o)
remove the object from the datastore
|
T |
save(T o)
Saves the passed object, and returns an attached entity.
|
void |
setFlushMode(org.hibernate.FlushMode flushMode)
Sets the flush mode (i.e. when objects are flushed to the database) of
the current thread-bound session.
|
public Class<T> getPersistenceClass()
getPersistenceClass in interface IDao<T,PK extends Serializable>public void flushAndClear()
IDaoflushAndClear in interface IDao<T,PK extends Serializable>public void remove(T o)
IDaoremove in interface IDao<T,PK extends Serializable>o - The object to removepublic T save(T o)
IDaosave in interface IDao<T,PK extends Serializable>o - The object to savepublic void setFlushMode(org.hibernate.FlushMode flushMode)
IDaoFlushModeType.AUTO, which lets the
persistence framework handle that issue. However, for performance
reasons, it might be necessary to set it to FlushModeType.COMMIT.
Warning : this sets the default flush mode of the session (either
hibernate Session, JPA EntityManager, or similar) that
is currently bound to the current thread. This means that it has
absolutely no effect if no transaction is currently opened.setFlushMode in interface IDao<T,PK extends Serializable>flushMode - The flush mode To set for this daopublic T get(PK id)
IDaoget in interface IDao<T,PK extends Serializable>id - the primarey keypublic boolean exists(PK id)
IDaoexists in interface IDao<T,PK extends Serializable>id - the id of the entitypublic List<T> getAll()
IDaogetAll in interface IDao<T,PK extends Serializable>public void deleteAll(List<T> list)
IDaodeleteAll in interface IDao<T,PK extends Serializable>list - the list of element to deletepublic long count()
count in interface IDao<T,PK extends Serializable>public List<T> getAllPaginate(int from, int maxResults)
IDaogetAllPaginate in interface IDao<T,PK extends Serializable>from - The first result to return numbered from 1maxResults - The maximum list size to returnCopyright © 2015. All rights reserved.