Package com.axelor.db

Class JpaSupport

    • Constructor Detail

      • JpaSupport

        public JpaSupport()
    • Method Detail

      • getEntityManager

        protected javax.persistence.EntityManager getEntityManager()
        Get the instance of current EntityManager.
        Returns:
        the EntityManager instance
      • all

        protected <T extends ModelQuery<T> all​(Class<T> modelClass)
        Get the Query instance for the given model class.
        Type Parameters:
        T - the type of the model
        Parameters:
        modelClass - the model class
        Returns:
        an instance of Query
      • inTransaction

        protected void inTransaction​(Runnable task)
        Run the given task inside a transaction that is committed after the task is completed.
        Parameters:
        task - the task to run
      • jdbcTask

        protected void jdbcTask​(JpaSupport.JDBCTask task)
        Perform JDBC related task using the Connection managed by the current EntityManager.
        Parameters:
        task - The task to be performed
        Throws:
        javax.persistence.PersistenceException - Generally indicates wrapped SQLException