|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.orm.jdo.support.JdoDaoSupport
Convenient super class for JDO data access objects. Requires a PersistenceManagerFactory to be set, providing a JdoTemplate based on it to subclasses.
This base class is mainly intended for JdoeTemplate usage but can also be used when working with PersistenceManagerFactoryUtils directly, e.g. in combination with JdoInterceptor-managed PersistenceManagers.
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory)
,
JdoTemplate
,
JdoInterceptor
Field Summary | |
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
JdoDaoSupport()
|
Method Summary | |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected void |
closeSessionIfNecessary(javax.jdo.PersistenceManager pm)
Close the given JDO PersistenceManager if necessary, created via this bean's PersistenceManagerFactory, if it isn't bound to the thread. |
protected DataAccessException |
convertJdoAccessException(javax.jdo.JDOException ex)
Convert the given JDOException to an appropriate exception from the org.springframework.dao hierarchy. |
protected JdoTemplate |
getJdoTemplate()
Return the JdoTemplate for this DAO, pre-initialized with the PersistenceManagerFactory or set explicitly. |
protected javax.jdo.PersistenceManager |
getPersistenceManager()
Get a JDO PersistenceManager, either from the current transaction or a new one. |
protected javax.jdo.PersistenceManager |
getPersistenceManager(boolean allowCreate)
Get a JDO PersistenceManager, either from the current transaction or a new one. |
protected javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
Return the JDO PersistenceManagerFactory used by this DAO. |
protected void |
initDao()
Subclasses can override this for custom initialization behavior. |
void |
setJdoTemplate(JdoTemplate jdoTemplate)
Set the JdoTemplate for this DAO explicitly, as an alternative to specifying a PersistenceManagerFactory. |
void |
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
Set the JDO PersistenceManagerFactory to be used by this DAO. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public JdoDaoSupport()
Method Detail |
public final void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory persistenceManagerFactory)
protected final javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
public final void setJdoTemplate(JdoTemplate jdoTemplate)
protected final JdoTemplate getJdoTemplate()
public final void afterPropertiesSet() throws java.lang.Exception
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
java.lang.Exception
- in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.protected void initDao() throws java.lang.Exception
java.lang.Exception
- if initialization failsprotected final javax.jdo.PersistenceManager getPersistenceManager()
DataAccessResourceFailureException
- if the Session couldn't be created
java.lang.IllegalStateException
- if no thread-bound Session found and allowCreate falsePersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
protected final javax.jdo.PersistenceManager getPersistenceManager(boolean allowCreate) throws DataAccessResourceFailureException
allowCreate
- if a new PersistenceManager should be created if no thread-bound found
DataAccessResourceFailureException
- if the Session couldn't be created
java.lang.IllegalStateException
- if no thread-bound Session 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 occured
setJdoTemplate(org.springframework.orm.jdo.JdoTemplate)
,
JdoAccessor.convertJdoAccessException(javax.jdo.JDOException)
protected final void closeSessionIfNecessary(javax.jdo.PersistenceManager pm) throws CleanupFailureDataAccessException
pm
- PersistenceManager to close
DataAccessResourceFailureException
- if the PersistenceManager couldn't be closed
CleanupFailureDataAccessException
PersistenceManagerFactoryUtils.closePersistenceManagerIfNecessary(javax.jdo.PersistenceManager, javax.jdo.PersistenceManagerFactory)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |