TransactionAwarePersistenceManagerFactoryProxy
and SpringPersistenceManagerProxyBean
)@Deprecated public abstract class JdoDaoSupport extends DaoSupport
Requires a PersistenceManagerFactory to be set, providing a JdoTemplate based on it to subclasses. Can alternatively be initialized directly with a JdoTemplate, to reuse the latter's settings such as the PersistenceManagerFactory, JdoDialect, flush mode, etc.
This base class is mainly intended for JdoTemplate usage but can also
be used when working with PersistenceManagerFactoryUtils directly, for example
in combination with JdoInterceptor-managed PersistenceManagers. Convenience
getPersistenceManager
and releasePersistenceManager
methods are provided for that usage style.
This class will create its own JdoTemplate if only a PersistenceManagerFactory
is passed in. The "allowCreate" flag on that JdoTemplate will be "true" by default.
A custom JdoTemplate instance can be used through overriding createJdoTemplate
.
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory)
,
setJdoTemplate(org.springframework.orm.jdo.JdoTemplate)
,
createJdoTemplate(javax.jdo.PersistenceManagerFactory)
,
getPersistenceManager()
,
releasePersistenceManager(javax.jdo.PersistenceManager)
,
JdoTemplate
,
JdoInterceptor
logger
Constructor and Description |
---|
JdoDaoSupport()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkDaoConfig()
Deprecated.
Abstract subclasses must override this to check their configuration.
|
protected DataAccessException |
convertJdoAccessException(javax.jdo.JDOException ex)
Deprecated.
Convert the given JDOException to an appropriate exception from the
org.springframework.dao hierarchy.
|
protected JdoTemplate |
createJdoTemplate(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
Deprecated.
Create a JdoTemplate for the given PersistenceManagerFactory.
|
JdoTemplate |
getJdoTemplate()
Deprecated.
Return the JdoTemplate for this DAO, pre-initialized
with the PersistenceManagerFactory or set explicitly.
|
protected javax.jdo.PersistenceManager |
getPersistenceManager()
Deprecated.
Get a JDO PersistenceManager, either from the current transaction or
a new one.
|
protected javax.jdo.PersistenceManager |
getPersistenceManager(boolean allowCreate)
Deprecated.
Get a JDO PersistenceManager, either from the current transaction or
a new one.
|
javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
Deprecated.
Return the JDO PersistenceManagerFactory used by this DAO.
|
protected void |
releasePersistenceManager(javax.jdo.PersistenceManager pm)
Deprecated.
Close the given JDO PersistenceManager, created via this DAO's
PersistenceManagerFactory, if it isn't bound to the thread.
|
void |
setJdoTemplate(JdoTemplate jdoTemplate)
Deprecated.
Set the JdoTemplate for this DAO explicitly,
as an alternative to specifying a PersistenceManagerFactory.
|
void |
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
Deprecated.
Set the JDO PersistenceManagerFactory to be used by this DAO.
|
afterPropertiesSet, initDao
public final void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
protected JdoTemplate createJdoTemplate(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
Can be overridden in subclasses to provide a JdoTemplate instance with different configuration, or a custom JdoTemplate subclass.
persistenceManagerFactory
- the JDO PersistenceManagerFactoryto create a JdoTemplate forsetPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory)
public final javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
public final void setJdoTemplate(JdoTemplate jdoTemplate)
public final JdoTemplate getJdoTemplate()
protected final void checkDaoConfig()
DaoSupport
Implementors should be marked as final
if concrete subclasses
are not supposed to override this template method themselves.
checkDaoConfig
in class DaoSupport
protected final javax.jdo.PersistenceManager getPersistenceManager()
DataAccessResourceFailureException
- if the PersistenceManager couldn't be createdIllegalStateException
- if no thread-bound PersistenceManager found and allowCreate falsePersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
protected final javax.jdo.PersistenceManager getPersistenceManager(boolean allowCreate) throws DataAccessResourceFailureException, IllegalStateException
allowCreate
- if a non-transactional PersistenceManager should be created
when no transactional PersistenceManager can be found for the current threadDataAccessResourceFailureException
- if the PersistenceManager couldn't be createdIllegalStateException
- if no thread-bound PersistenceManager found and allowCreate falsePersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
protected final DataAccessException convertJdoAccessException(javax.jdo.JDOException ex)
Delegates to the convertJdoAccessException method of this DAO's JdoTemplate.
ex
- JDOException that occuredsetJdoTemplate(org.springframework.orm.jdo.JdoTemplate)
,
JdoAccessor.convertJdoAccessException(javax.jdo.JDOException)
protected final void releasePersistenceManager(javax.jdo.PersistenceManager pm)
pm
- PersistenceManager to closePersistenceManagerFactoryUtils.releasePersistenceManager(javax.jdo.PersistenceManager, javax.jdo.PersistenceManagerFactory)