Package org.opennms.netmgt.dao.hibernate
Class AbstractCachingDaoHibernate<T,DbKey extends Serializable,CacheKey>
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.orm.hibernate3.support.HibernateDaoSupport
-
- org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate<T,DbKey>
-
- org.opennms.netmgt.dao.hibernate.AbstractCachingDaoHibernate<T,DbKey,CacheKey>
-
- All Implemented Interfaces:
OnmsDao<T,DbKey>
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
CategoryDaoHibernate
,ServiceTypeDaoHibernate
public abstract class AbstractCachingDaoHibernate<T,DbKey extends Serializable,CacheKey> extends AbstractDaoHibernate<T,DbKey>
AbstractCachingDaoHibernate- Version:
- $Id: $
- Author:
- brozow
-
-
Field Summary
-
Fields inherited from class org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate
m_criteriaConverter
-
-
Constructor Summary
Constructors Constructor Description AbstractCachingDaoHibernate(Class<T> entityClass, boolean dbKeyMatchesCacheKey)
Constructor for AbstractCachingDaoHibernate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
void
delete(T entity)
deletevoid
deleteAll(Collection<T> entities)
deleteAllList<T>
findAll()
findAllprotected T
findByCacheKey(String queryString, CacheKey key)
findByCacheKeyT
get(DbKey id)
getprotected abstract CacheKey
getKey(T t)
getKeyT
load(DbKey id)
loadvoid
merge(T entity)
DbKey
save(T entity)
savevoid
saveOrUpdate(T entity)
saveOrUpdatevoid
update(T entity)
update-
Methods inherited from class org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate
buildHibernateCallback, bulkDelete, countAll, countMatching, countMatching, delete, find, find, findMatching, findMatching, findObjects, findUnique, flush, initDao, initialize, lock, queryInt, queryInt
-
-
-
-
Constructor Detail
-
AbstractCachingDaoHibernate
public AbstractCachingDaoHibernate(Class<T> entityClass, boolean dbKeyMatchesCacheKey)
Constructor for AbstractCachingDaoHibernate.
- Type Parameters:
T
- a T object.DbKey
- a DbKey object.CacheKey
- a CacheKey object.- Parameters:
entityClass
- aClass
object.dbKeyMatchesCacheKey
- a boolean.
-
-
Method Detail
-
getKey
protected abstract CacheKey getKey(T t)
getKey
- Parameters:
t
- a T object.- Returns:
- a CacheKey object.
-
clear
public void clear()
- Specified by:
clear
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
clear
in classAbstractDaoHibernate<T,DbKey extends Serializable>
-
deleteAll
public void deleteAll(Collection<T> entities) throws org.springframework.dao.DataAccessException
deleteAll
- Overrides:
deleteAll
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
entities
- aCollection
object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
delete
public void delete(T entity) throws org.springframework.dao.DataAccessException
delete
- Specified by:
delete
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
delete
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
findAll
public List<T> findAll() throws org.springframework.dao.DataAccessException
findAll
- Specified by:
findAll
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
findAll
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Returns:
- a
List
object. - Throws:
org.springframework.dao.DataAccessException
- if any.
-
get
public T get(DbKey id) throws org.springframework.dao.DataAccessException
get
- Specified by:
get
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
get
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
id
- a K object.- Returns:
- a T object.
- Throws:
org.springframework.dao.DataAccessException
- if any.
-
load
public T load(DbKey id) throws org.springframework.dao.DataAccessException
load
- Specified by:
load
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
load
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
id
- a K object.- Returns:
- a T object.
- Throws:
org.springframework.dao.DataAccessException
- if any.
-
merge
public void merge(T entity)
- Overrides:
merge
in classAbstractDaoHibernate<T,DbKey extends Serializable>
-
save
public DbKey save(T entity) throws org.springframework.dao.DataAccessException
save
- Specified by:
save
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
save
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
saveOrUpdate
public void saveOrUpdate(T entity) throws org.springframework.dao.DataAccessException
saveOrUpdate
- Specified by:
saveOrUpdate
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
saveOrUpdate
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
update
public void update(T entity) throws org.springframework.dao.DataAccessException
update
- Specified by:
update
in interfaceOnmsDao<T,DbKey extends Serializable>
- Overrides:
update
in classAbstractDaoHibernate<T,DbKey extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
-