|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
com.gisgraphy.domain.repository.GenericDao<T,PK>
public class GenericDao<T,PK extends Serializable>
A generic dao That implements basic functions with java 5.0 generics
Field Summary | |
---|---|
protected Class<T> |
persistentClass
|
Fields inherited from class org.springframework.dao.support.DaoSupport |
---|
logger |
Constructor Summary | |
---|---|
GenericDao(Class<T> persistentClass)
constructor |
Method Summary | |
---|---|
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. |
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
---|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
---|
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Class<T> persistentClass
Constructor Detail |
---|
public GenericDao(Class<T> persistentClass)
persistentClass
- The specified Class for the GenericDaoMethod Detail |
---|
public Class<T> getPersistenceClass()
getPersistenceClass
in interface IDao<T,PK extends Serializable>
public void flushAndClear()
IDao
flushAndClear
in interface IDao<T,PK extends Serializable>
public void remove(T o)
IDao
remove
in interface IDao<T,PK extends Serializable>
o
- The object to removepublic T save(T o)
IDao
save
in interface IDao<T,PK extends Serializable>
o
- The object to save
public void setFlushMode(org.hibernate.FlushMode flushMode)
IDao
FlushModeType.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)
IDao
get
in interface IDao<T,PK extends Serializable>
id
- the primarey key
public boolean exists(PK id)
IDao
exists
in interface IDao<T,PK extends Serializable>
id
- the id of the entity
public List<T> getAll()
IDao
getAll
in interface IDao<T,PK extends Serializable>
public void deleteAll(List<T> list)
IDao
deleteAll
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)
IDao
getAllPaginate
in interface IDao<T,PK extends Serializable>
from
- The first result to return numbered from 1maxResults
- The maximum list size to return
public int deleteAll()
IDao
deleteAll
in interface IDao<T,PK extends Serializable>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |