Class AbstractDaoHibernate<T,​K extends java.io.Serializable>

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractDaoHibernate​(java.lang.Class<T> entityClass)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <T> org.springframework.orm.hibernate3.HibernateCallback<java.util.List<T>> buildHibernateCallback​(Criteria criteria)  
      int bulkDelete​(java.lang.String hql, java.lang.Object[] values)
      bulkDelete
      void clear()
      int countAll()
      countAll
      int countMatching​(Criteria criteria)
      int countMatching​(OnmsCriteria onmsCrit)
      void delete​(K key)
      delete
      void delete​(T entity)
      delete
      void deleteAll​(java.util.Collection<T> entities)
      deleteAll
      java.util.List<T> find​(java.lang.String query)
      find
      java.util.List<T> find​(java.lang.String query, java.lang.Object... values)
      find
      java.util.List<T> findAll()
      findAll
      java.util.List<T> findMatching​(Criteria criteria)  
      java.util.List<T> findMatching​(OnmsCriteria onmsCrit)
      <S> java.util.List<S> findObjects​(java.lang.Class<S> clazz, java.lang.String query, java.lang.Object... values)
      findObjects
      protected T findUnique​(java.lang.String queryString, java.lang.Object... args)
      Return a single instance that matches the query string, or null if the query returns no results.
      void flush()
      T get​(K id)
      get
      protected void initDao()  
      void initialize​(java.lang.Object obj)
      T load​(K id)
      load
      void lock()
      This is used to lock the table in order to implement upsert type operations
      void merge​(T entity)  
      protected int queryInt​(java.lang.String query)
      queryInt
      protected int queryInt​(java.lang.String queryString, java.lang.Object... args)
      queryInt
      K save​(T entity)
      save
      void saveOrUpdate​(T entity)
      saveOrUpdate
      void update​(T entity)
      update
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractDaoHibernate

        public AbstractDaoHibernate​(java.lang.Class<T> entityClass)
    • Method Detail

      • initDao

        protected void initDao()
                        throws java.lang.Exception
        Overrides:
        initDao in class org.springframework.dao.support.DaoSupport
        Throws:
        java.lang.Exception
      • lock

        public void lock()
        This is used to lock the table in order to implement upsert type operations
        Specified by:
        lock in interface OnmsDao<T,​K extends java.io.Serializable>
      • initialize

        public void initialize​(java.lang.Object obj)
        Specified by:
        initialize in interface OnmsDao<T,​K extends java.io.Serializable>
      • flush

        public void flush()
        Specified by:
        flush in interface OnmsDao<T,​K extends java.io.Serializable>
      • clear

        public void clear()
        Specified by:
        clear in interface OnmsDao<T,​K extends java.io.Serializable>
      • merge

        public void merge​(T entity)
      • find

        public java.util.List<T> find​(java.lang.String query)

        find

        Parameters:
        query - a String object.
        Returns:
        a List object.
      • find

        public java.util.List<T> find​(java.lang.String query,
                                      java.lang.Object... values)

        find

        Parameters:
        query - a String object.
        values - a Object object.
        Returns:
        a List object.
      • findObjects

        public <S> java.util.List<S> findObjects​(java.lang.Class<S> clazz,
                                                 java.lang.String query,
                                                 java.lang.Object... values)

        findObjects

        Type Parameters:
        S - a S object.
        Parameters:
        clazz - a Class object.
        query - a String object.
        values - a Object object.
        Returns:
        a List object.
      • queryInt

        protected int queryInt​(java.lang.String query)

        queryInt

        Parameters:
        query - a String object.
        Returns:
        a int.
      • queryInt

        protected int queryInt​(java.lang.String queryString,
                               java.lang.Object... args)

        queryInt

        Parameters:
        queryString - a String object.
        args - a Object object.
        Returns:
        a int.
      • findUnique

        protected T findUnique​(java.lang.String queryString,
                               java.lang.Object... args)
        Return a single instance that matches the query string, or null if the query returns no results.
      • countAll

        public int countAll()

        countAll

        Specified by:
        countAll in interface OnmsDao<T,​K extends java.io.Serializable>
        Returns:
        a int.
      • delete

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

        delete

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

        public void delete​(K key)
                    throws org.springframework.dao.DataAccessException

        delete

        Specified by:
        delete in interface OnmsDao<T,​K extends java.io.Serializable>
        Parameters:
        key - a K object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • deleteAll

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

        deleteAll

        Parameters:
        entities - a Collection 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,​K extends java.io.Serializable>
        Returns:
        a List object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • findMatching

        public java.util.List<T> findMatching​(Criteria criteria)
        Specified by:
        findMatching in interface OnmsDao<T,​K extends java.io.Serializable>
      • buildHibernateCallback

        protected <T> org.springframework.orm.hibernate3.HibernateCallback<java.util.List<T>> buildHibernateCallback​(Criteria criteria)
      • countMatching

        public int countMatching​(Criteria criteria)
                          throws org.springframework.dao.DataAccessException
        Specified by:
        countMatching in interface OnmsDao<T,​K extends java.io.Serializable>
        Throws:
        org.springframework.dao.DataAccessException
      • findMatching

        public java.util.List<T> findMatching​(OnmsCriteria onmsCrit)
                                       throws org.springframework.dao.DataAccessException
        Throws:
        org.springframework.dao.DataAccessException
      • countMatching

        public int countMatching​(OnmsCriteria onmsCrit)
                          throws org.springframework.dao.DataAccessException
        Throws:
        org.springframework.dao.DataAccessException
      • bulkDelete

        public int bulkDelete​(java.lang.String hql,
                              java.lang.Object[] values)
                       throws org.springframework.dao.DataAccessException

        bulkDelete

        Parameters:
        hql - a String object.
        values - an array of Object objects.
        Returns:
        a int.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • get

        public T get​(K id)
              throws org.springframework.dao.DataAccessException

        get

        Specified by:
        get in interface OnmsDao<T,​K extends java.io.Serializable>
        Parameters:
        id - a K object.
        Returns:
        a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • load

        public T load​(K id)
               throws org.springframework.dao.DataAccessException

        load

        Specified by:
        load in interface OnmsDao<T,​K extends java.io.Serializable>
        Parameters:
        id - a K object.
        Returns:
        a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.
      • save

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

        save

        Specified by:
        save in interface OnmsDao<T,​K 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,​K 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,​K extends java.io.Serializable>
        Parameters:
        entity - a T object.
        Throws:
        org.springframework.dao.DataAccessException - if any.