| java.lang.Object org.springframework.orm.jdo.PersistenceManagerFactoryUtils
PersistenceManagerFactoryUtils | abstract public class PersistenceManagerFactoryUtils (Code) | | Helper class featuring methods for JDO PersistenceManager handling,
allowing for reuse of PersistenceManager instances within transactions.
Also provides support for exception translation.
Used by JdoTemplate, JdoInterceptor, and JdoTransactionManager.
Can also be used directly in application code, e.g. in combination
with JdoInterceptor.
author: Juergen Hoeller since: 03.06.2003 See Also: JdoTemplate See Also: JdoInterceptor See Also: JdoTransactionManager |
Method Summary | |
public static void | applyTransactionTimeout(Query query, PersistenceManagerFactory pmf, JdoDialect jdoDialect) Apply the current transaction timeout, if any, to the given JDO Query object. | public static DataAccessException | convertJdoAccessException(JDOException ex) Convert the given JDOException to an appropriate exception from the
org.springframework.dao hierarchy.
The most important cases like object not found or optimistic locking
failure are covered here. | public static PersistenceManager | doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) Obtain a JDO PersistenceManager via the given factory. | public static void | doReleasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf) Actually release a PersistenceManager for the given factory. | public static PersistenceManager | getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) Obtain a JDO PersistenceManager via the given factory. | public static boolean | isPersistenceManagerTransactional(PersistenceManager pm, PersistenceManagerFactory pmf) Return whether the given JDO PersistenceManager is transactional, that is,
bound to the current thread by Spring's transaction facilities. | static SQLExceptionTranslator | newJdbcExceptionTranslator(Object connectionFactory) Create an appropriate SQLExceptionTranslator for the given PersistenceManagerFactory. | public static void | releasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf) Close the given PersistenceManager, created via the given factory,
if it is not managed externally (i.e. |
applyTransactionTimeout | public static void applyTransactionTimeout(Query query, PersistenceManagerFactory pmf, JdoDialect jdoDialect) throws JDOException(Code) | | Apply the current transaction timeout, if any, to the given JDO Query object.
Parameters: query - the JDO Query object Parameters: pmf - JDO PersistenceManagerFactory that the Query was created for Parameters: jdoDialect - the JdoDialect to use for applying a query timeout(must not be null ) See Also: JdoDialect.applyQueryTimeout |
doGetPersistenceManager | public static PersistenceManager doGetPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) throws JDOException, IllegalStateException(Code) | | 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.
Parameters: pmf - PersistenceManagerFactory to create the PersistenceManager with Parameters: allowCreate - if a non-transactional PersistenceManager should be createdwhen no transactional PersistenceManager can be found for the current thread the PersistenceManager throws: JDOException - if the PersistenceManager couldn't be created throws: IllegalStateException - if no thread-bound PersistenceManager found and"allowCreate" is false See Also: PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory,boolean) See Also: JdoTransactionManager |
doReleasePersistenceManager | public static void doReleasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf) throws JDOException(Code) | | Actually release a PersistenceManager for the given factory.
Same as releasePersistenceManager , but throwing the original JDOException.
Parameters: pm - PersistenceManager to close Parameters: pmf - PersistenceManagerFactory that the PersistenceManager was created with(can be null ) throws: JDOException - if thrown by JDO methods |
getPersistenceManager | public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate) throws DataAccessResourceFailureException, IllegalStateException(Code) | | 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 .
Parameters: pmf - PersistenceManagerFactory to create the PersistenceManager with Parameters: allowCreate - if a non-transactional PersistenceManager should be createdwhen no transactional PersistenceManager can be found for the current thread the PersistenceManager throws: DataAccessResourceFailureException - if the PersistenceManager couldn't be obtained throws: IllegalStateException - if no thread-bound PersistenceManager found and"allowCreate" is false See Also: JdoTransactionManager |
isPersistenceManagerTransactional | public static boolean isPersistenceManagerTransactional(PersistenceManager pm, PersistenceManagerFactory pmf)(Code) | | Return whether the given JDO PersistenceManager is transactional, that is,
bound to the current thread by Spring's transaction facilities.
Parameters: pm - the JDO PersistenceManager to check Parameters: pmf - JDO PersistenceManagerFactory that the PersistenceManagerwas created with (can be null ) whether the PersistenceManager is transactional |
releasePersistenceManager | public static void releasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf)(Code) | | Close the given PersistenceManager, created via the given factory,
if it is not managed externally (i.e. not bound to the thread).
Parameters: pm - PersistenceManager to close Parameters: pmf - PersistenceManagerFactory that the PersistenceManager was created with(can be null ) |
|
|