|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.orm.jdo.PersistenceManagerFactoryUtils
Helper class featuring methods for JDO PersistenceManager handling, allowing for reuse of PersistenceManager instances within transactions.
Used by JdoTemplate, JdoInterceptor, and JdoTransactionManager. Can also be used directly in application code, e.g. in combination with JdoInterceptor.
JdoTemplate
,
JdoInterceptor
,
JdoTransactionManager
Constructor Summary | |
PersistenceManagerFactoryUtils()
|
Method Summary | |
static void |
closePersistenceManagerIfNecessary(javax.jdo.PersistenceManager pm,
javax.jdo.PersistenceManagerFactory pmf)
Close the given PersistenceManager, created via the given factory, if it isn't bound to the thread. |
static DataAccessException |
convertJdoAccessException(javax.jdo.JDOException ex)
Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy. |
static javax.jdo.PersistenceManager |
getPersistenceManager(javax.jdo.PersistenceManagerFactory pmf,
boolean allowCreate)
Get a JDO PersistenceManager via the given factory. |
static javax.jdo.PersistenceManager |
getPersistenceManager(javax.jdo.PersistenceManagerFactory pmf,
boolean allowCreate,
boolean allowSynchronization)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PersistenceManagerFactoryUtils()
Method Detail |
public static javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.PersistenceManagerFactory pmf, boolean allowCreate) throws DataAccessResourceFailureException
pmf
- PersistenceManagerFactory to create the session withallowCreate
- if a new PersistenceManager should be created if no thread-bound found
DataAccessResourceFailureException
- if the PersistenceManager couldn't be created
java.lang.IllegalStateException
- if no thread-bound PersistenceManager found and allowCreate falsepublic static javax.jdo.PersistenceManager getPersistenceManager(javax.jdo.PersistenceManagerFactory pmf, boolean allowCreate, boolean allowSynchronization) throws DataAccessResourceFailureException
DataAccessResourceFailureException
public static DataAccessException convertJdoAccessException(javax.jdo.JDOException ex)
Unfortunately, JDO's JDOUserException covers a lot of distinct causes like unparsable query, optimistic locking failure, etc. Thus, we are not able to convert to Spring's DataAccessException hierarchy in a fine-granular way with standard JDO. JdoAccessor and JdoTransactionManager support more sophisticated translation of exceptions via a JdoDialect.
ex
- JDOException that occured
JdoDialect.translateException(javax.jdo.JDOException)
public static void closePersistenceManagerIfNecessary(javax.jdo.PersistenceManager pm, javax.jdo.PersistenceManagerFactory pmf) throws CleanupFailureDataAccessException
pm
- PersistenceManager to closepmf
- PersistenceManagerFactory that the PersistenceManager was created with
DataAccessResourceFailureException
- if the PersistenceManager couldn't be closed
CleanupFailureDataAccessException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |