org.appfuse.dao.hibernate
Class BaseDaoHibernate

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.appfuse.dao.hibernate.BaseDaoHibernate
All Implemented Interfaces:
Dao, InitializingBean
Direct Known Subclasses:
LookupDaoHibernate, RoleDaoHibernate, UserDaoHibernate

public class BaseDaoHibernate
extends HibernateDaoSupport
implements Dao

This class serves as the Base class for all other Daos - namely to hold common methods that they might all use. Can be used for standard CRUD operations.

View Source

Author:
Matt Raible

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BaseDaoHibernate()
           
 
Method Summary
 Object getObject(Class clazz, Serializable id)
          Generic method to get an object based on class and identifier.
 List getObjects(Class clazz)
          Generic method used to get all objects of a particular type.
 void removeObject(Class clazz, Serializable id)
          Generic method to delete an object based on class and id
 void saveObject(Object o)
          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

log

protected final org.apache.commons.logging.Log log
Constructor Detail

BaseDaoHibernate

public BaseDaoHibernate()
Method Detail

saveObject

public void saveObject(Object o)
Description copied from interface: Dao
Generic method to save an object - handles both update and insert.

Specified by:
saveObject in interface Dao
Parameters:
o - the object to save
See Also:
Dao.saveObject(java.lang.Object)

getObject

public Object getObject(Class clazz,
                        Serializable id)
Description copied from interface: Dao
Generic method to get an object based on class and identifier. An ObjectRetrievalFailureException Runtime Exception is thrown if nothing is found.

Specified by:
getObject in interface Dao
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
Returns:
a populated object
See Also:
Dao.getObject(java.lang.Class, java.io.Serializable)

getObjects

public List getObjects(Class clazz)
Description copied from interface: Dao
Generic method used to get all objects of a particular type. This is the same as lookup up all rows in a table.

Specified by:
getObjects in interface Dao
Parameters:
clazz - the type of objects (a.k.a. while table) to get data from
Returns:
List of populated objects
See Also:
Dao.getObjects(java.lang.Class)

removeObject

public void removeObject(Class clazz,
                         Serializable id)
Description copied from interface: Dao
Generic method to delete an object based on class and id

Specified by:
removeObject in interface Dao
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
See Also:
Dao.removeObject(java.lang.Class, java.io.Serializable)


Copyright � 2002-2006