类 PersistenceManagerFactoryUtils

    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型方法说明
      static voidapplyTransactionTimeout​(javax.jdo.Query query, javax.jdo.PersistenceManagerFactory pmf)
      Apply the current transaction timeout, if any, to the given JDO Query object.
      static DataAccessExceptionconvertJdoAccessException​(javax.jdo.JDOException ex)
      Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy.
      static javax.jdo.PersistenceManagerdoGetPersistenceManager​(javax.jdo.PersistenceManagerFactory pmf, boolean allowCreate)
      Obtain a JDO PersistenceManager via the given factory.
      static voiddoReleasePersistenceManager​(javax.jdo.PersistenceManager pm, javax.jdo.PersistenceManagerFactory pmf)
      Actually release a PersistenceManager for the given factory.
      static javax.jdo.PersistenceManagergetPersistenceManager​(javax.jdo.PersistenceManagerFactory pmf, boolean allowCreate)
      Obtain a JDO PersistenceManager via the given factory.
      static booleanisPersistenceManagerTransactional​(javax.jdo.PersistenceManager pm, javax.jdo.PersistenceManagerFactory pmf)
      Return whether the given JDO PersistenceManager is transactional, that is, bound to the current thread by Spring's transaction facilities.
      static voidreleasePersistenceManager​(javax.jdo.PersistenceManager pm, javax.jdo.PersistenceManagerFactory pmf)
      Close the given PersistenceManager, created via the given factory, if it is not managed externally (i.e. not bound to the thread).
    • 方法详细资料

      • getPersistenceManager

        public static javax.jdo.PersistenceManager getPersistenceManager​(javax.jdo.PersistenceManagerFactory pmf,
                                                                         boolean allowCreate)
                                                                  throws DataAccessResourceFailureException,
                                                                         IllegalStateException
        Obtain a JDO PersistenceManager via the given factory. Is aware of a corresponding PersistenceManager bound to the current thread, for example when using JdoTransactionManager. Will create a new PersistenceManager else, if "allowCreate" is true.
        参数:
        pmf - PersistenceManagerFactory to create the PersistenceManager with
        allowCreate - if a non-transactional PersistenceManager should be created when no transactional PersistenceManager can be found for the current thread
        返回:
        the PersistenceManager
        抛出:
        DataAccessResourceFailureException - if the PersistenceManager couldn't be obtained
        IllegalStateException - if no thread-bound PersistenceManager found and "allowCreate" is false
        另请参阅:
        JdoTransactionManager
      • doGetPersistenceManager

        public static javax.jdo.PersistenceManager doGetPersistenceManager​(javax.jdo.PersistenceManagerFactory pmf,
                                                                           boolean allowCreate)
                                                                    throws javax.jdo.JDOException,
                                                                           IllegalStateException
        Obtain a JDO PersistenceManager via the given factory. Is aware of a corresponding PersistenceManager bound to the current thread, for example when using JdoTransactionManager. Will create a new PersistenceManager else, if "allowCreate" is true.

        Same as getPersistenceManager, but throwing the original JDOException.

        参数:
        pmf - PersistenceManagerFactory to create the PersistenceManager with
        allowCreate - if a non-transactional PersistenceManager should be created when no transactional PersistenceManager can be found for the current thread
        返回:
        the PersistenceManager
        抛出:
        javax.jdo.JDOException - if the PersistenceManager couldn't be created
        IllegalStateException - if no thread-bound PersistenceManager found and "allowCreate" is false
        另请参阅:
        getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean), JdoTransactionManager
      • isPersistenceManagerTransactional

        public static boolean isPersistenceManagerTransactional​(javax.jdo.PersistenceManager pm,
                                                                javax.jdo.PersistenceManagerFactory pmf)
        Return whether the given JDO PersistenceManager is transactional, that is, bound to the current thread by Spring's transaction facilities.
        参数:
        pm - the JDO PersistenceManager to check
        pmf - JDO PersistenceManagerFactory that the PersistenceManager was created with (can be null)
        返回:
        whether the PersistenceManager is transactional
      • applyTransactionTimeout

        public static void applyTransactionTimeout​(javax.jdo.Query query,
                                                   javax.jdo.PersistenceManagerFactory pmf)
                                            throws javax.jdo.JDOException
        Apply the current transaction timeout, if any, to the given JDO Query object.
        参数:
        query - the JDO Query object
        pmf - JDO PersistenceManagerFactory that the Query was created for
        抛出:
        javax.jdo.JDOException - if thrown by JDO methods
      • releasePersistenceManager

        public static void releasePersistenceManager​(javax.jdo.PersistenceManager pm,
                                                     javax.jdo.PersistenceManagerFactory pmf)
        Close the given PersistenceManager, created via the given factory, if it is not managed externally (i.e. not bound to the thread).
        参数:
        pm - PersistenceManager to close
        pmf - PersistenceManagerFactory that the PersistenceManager was created with (can be null)
      • doReleasePersistenceManager

        public static void doReleasePersistenceManager​(javax.jdo.PersistenceManager pm,
                                                       javax.jdo.PersistenceManagerFactory pmf)
                                                throws javax.jdo.JDOException
        Actually release a PersistenceManager for the given factory. Same as releasePersistenceManager, but throwing the original JDOException.
        参数:
        pm - PersistenceManager to close
        pmf - PersistenceManagerFactory that the PersistenceManager was created with (can be null)
        抛出:
        javax.jdo.JDOException - if thrown by JDO methods