Class AbstractCachingDaoHibernate<T,​DbKey extends java.io.Serializable,​CacheKey>

  • All Implemented Interfaces:
    OnmsDao<T,​DbKey>, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    CategoryDaoHibernate, ServiceTypeDaoHibernate

    public abstract class AbstractCachingDaoHibernate<T,​DbKey extends java.io.Serializable,​CacheKey>
    extends AbstractDaoHibernate<T,​DbKey>
    AbstractCachingDaoHibernate
    Version:
    $Id: $
    Author:
    brozow
    • Constructor Detail

      • AbstractCachingDaoHibernate

        public AbstractCachingDaoHibernate​(java.lang.Class<T> entityClass,
                                           boolean dbKeyMatchesCacheKey)

        Constructor for AbstractCachingDaoHibernate.

        Type Parameters:
        T - a T object.
        DbKey - a DbKey object.
        CacheKey - a CacheKey object.
        Parameters:
        entityClass - a Class object.
        dbKeyMatchesCacheKey - a boolean.
    • Method Detail

      • getKey

        protected abstract CacheKey getKey​(T t)

        getKey

        Parameters:
        t - a T object.
        Returns:
        a CacheKey object.
      • deleteAll

        public void deleteAll​(java.util.Collection<T> entities)
                       throws org.springframework.dao.DataAccessException

        deleteAll

        Overrides:
        deleteAll in class AbstractDaoHibernate<T,​DbKey extends java.io.Serializable>
        Parameters:
        entities - a Collection object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • delete

        public void delete​(T entity)
                    throws org.springframework.dao.DataAccessException

        delete

        Specified by:
        delete in interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        delete in class AbstractDaoHibernate<T,​DbKey extends java.io.Serializable>
        Parameters:
        entity - a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • findAll

        public java.util.List<T> findAll()
                                  throws org.springframework.dao.DataAccessException

        findAll

        Specified by:
        findAll in interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        findAll in class AbstractDaoHibernate<T,​DbKey extends java.io.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 interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        get in class AbstractDaoHibernate<T,​DbKey extends java.io.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 interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        load in class AbstractDaoHibernate<T,​DbKey extends java.io.Serializable>
        Parameters:
        id - a K object.
        Returns:
        a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • save

        public DbKey save​(T entity)
                   throws org.springframework.dao.DataAccessException

        save

        Specified by:
        save in interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        save in class AbstractDaoHibernate<T,​DbKey extends java.io.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 interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        saveOrUpdate in class AbstractDaoHibernate<T,​DbKey extends java.io.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 interface OnmsDao<T,​DbKey extends java.io.Serializable>
        Overrides:
        update in class AbstractDaoHibernate<T,​DbKey extends java.io.Serializable>
        Parameters:
        entity - a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • findByCacheKey

        protected T findByCacheKey​(java.lang.String queryString,
                                   CacheKey key)

        findByCacheKey

        Parameters:
        queryString - a String object.
        key - a CacheKey object.
        Returns:
        a T object.