org.opennms.netmgt.dao.hibernate
Class AbstractCachingDaoHibernate<T,DbKey extends Serializable,CacheKey>

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate<T,DbKey>
              extended by org.opennms.netmgt.dao.hibernate.AbstractCachingDaoHibernate<T,DbKey,CacheKey>
All Implemented Interfaces:
OnmsDao<T,DbKey>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
CategoryDaoHibernate, DistPollerDaoHibernate, ServiceTypeDaoHibernate

public abstract class AbstractCachingDaoHibernate<T,DbKey extends Serializable,CacheKey>
extends AbstractDaoHibernate<T,DbKey>

AbstractCachingDaoHibernate

Author:
brozow

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
AbstractCachingDaoHibernate(Class<T> entityClass, boolean dbKeyMatchesCacheKey)
           
 
Method Summary
 void clear()
           
 void delete(T entity)
           
 void deleteAll(Collection<T> entities)
           
 List<T> findAll()
           
protected  T findByCacheKey(String queryString, CacheKey key)
           
 T get(DbKey id)
           
protected abstract  CacheKey getKey(T t)
           
 T load(DbKey id)
           
 void merge(T entity)
           
 void save(T entity)
           
 void saveOrUpdate(T entity)
           
 void update(T entity)
           
 
Methods inherited from class org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate
bulkDelete, countAll, countMatching, evict, find, find, findMatching, findMatchingObjects, findObjects, findUnique, findUnique, findUnique, flush, initialize, queryInt, queryInt
 
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
 

Constructor Detail

AbstractCachingDaoHibernate

public AbstractCachingDaoHibernate(Class<T> entityClass,
                                   boolean dbKeyMatchesCacheKey)
Method Detail

getKey

protected abstract CacheKey getKey(T t)

clear

public void clear()
Specified by:
clear in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
clear in class AbstractDaoHibernate<T,DbKey extends Serializable>

deleteAll

public void deleteAll(Collection<T> entities)
               throws org.springframework.dao.DataAccessException
Overrides:
deleteAll in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

delete

public void delete(T entity)
            throws org.springframework.dao.DataAccessException
Specified by:
delete in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
delete in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

findAll

public List<T> findAll()
                throws org.springframework.dao.DataAccessException
Specified by:
findAll in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
findAll in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

get

public T get(DbKey id)
      throws org.springframework.dao.DataAccessException
Specified by:
get in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
get in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

load

public T load(DbKey id)
       throws org.springframework.dao.DataAccessException
Specified by:
load in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
load in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

merge

public void merge(T entity)
Overrides:
merge in class AbstractDaoHibernate<T,DbKey extends Serializable>

save

public void save(T entity)
          throws org.springframework.dao.DataAccessException
Specified by:
save in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
save in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

saveOrUpdate

public void saveOrUpdate(T entity)
                  throws org.springframework.dao.DataAccessException
Specified by:
saveOrUpdate in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
saveOrUpdate in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

update

public void update(T entity)
            throws org.springframework.dao.DataAccessException
Specified by:
update in interface OnmsDao<T,DbKey extends Serializable>
Overrides:
update in class AbstractDaoHibernate<T,DbKey extends Serializable>
Throws:
org.springframework.dao.DataAccessException

findByCacheKey

protected T findByCacheKey(String queryString,
                           CacheKey key)


Copyright © 2009. All Rights Reserved.