|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
com.germinus.merlin.dao.GenericDaoHibernate<T,PK>
public abstract class GenericDaoHibernate<T,PK extends java.io.Serializable>
This class serves as the Base class for all other DAOs - namely to hold common CRUD methods that they might all use. You should only need to extend this class when your require custom CRUD logic.
To register this class in your Spring context file, use the following XML.
<bean id="fooDao" class="org.appfuse.dao.hibernate.GenericDaoHibernate"> <constructor-arg value="org.appfuse.model.Foo"/> <property name="sessionFactory" ref="sessionFactory"/> </bean>
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log
|
Fields inherited from class org.springframework.dao.support.DaoSupport |
---|
logger |
Constructor Summary | |
---|---|
GenericDaoHibernate(java.lang.Class<T> persistentClass)
|
Method Summary | |
---|---|
boolean |
exists(PK id)
Checks for existence of an object of type T using the id arg. |
T |
get(PK id)
Generic method to get an object based on class and identifier. |
java.util.List<T> |
getAll()
Generic method used to get all objects of a particular type. |
void |
remove(PK id)
Generic method to delete an object based on class and id |
T |
save(T object)
Generic method to save an object - handles both update and insert. |
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 final org.apache.commons.logging.Log log
Constructor Detail |
---|
public GenericDaoHibernate(java.lang.Class<T> persistentClass)
Method Detail |
---|
public java.util.List<T> getAll()
IGenericDao
getAll
in interface IGenericDao<T,PK extends java.io.Serializable>
public T get(PK id)
IGenericDao
get
in interface IGenericDao<T,PK extends java.io.Serializable>
id
- the identifier (primary assignmentId) of the object to get
ObjectRetrievalFailureException
public boolean exists(PK id)
IGenericDao
exists
in interface IGenericDao<T,PK extends java.io.Serializable>
public T save(T object)
IGenericDao
save
in interface IGenericDao<T,PK extends java.io.Serializable>
object
- the object to savepublic void remove(PK id)
IGenericDao
remove
in interface IGenericDao<T,PK extends java.io.Serializable>
id
- the identifier (primary assignmentId) of the object to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |