public class OpenPersistenceManagerInViewInterceptor extends Object implements org.springframework.web.context.request.WebRequestInterceptor
This interceptor makes JDO PersistenceManagers available via the current thread,
which will be autodetected by transaction managers. It is suitable for service
layer transactions via JdoTransactionManager
or JtaTransactionManager
as well
as for non-transactional read-only execution.
In contrast to OpenPersistenceManagerInViewFilter
, this interceptor
is set up in a Spring application context and can thus take advantage of
bean wiring.
OpenPersistenceManagerInViewFilter
,
JdoTransactionManager
,
PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
,
TransactionSynchronizationManager
Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
static String |
PARTICIPATE_SUFFIX
Suffix that gets appended to the PersistenceManagerFactory toString
representation for the "participate in existing persistence manager
handling" request attribute.
|
Constructor and Description |
---|
OpenPersistenceManagerInViewInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(org.springframework.web.context.request.WebRequest request,
Exception ex) |
protected String |
getParticipateAttributeName()
Return the name of the request attribute that identifies that a request is
already filtered.
|
javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
Return the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers.
|
void |
postHandle(org.springframework.web.context.request.WebRequest request,
org.springframework.ui.ModelMap model) |
void |
preHandle(org.springframework.web.context.request.WebRequest request) |
void |
setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
Set the JDO PersistenceManagerFactory that should be used to create
PersistenceManagers.
|
public static final String PARTICIPATE_SUFFIX
protected final Log logger
public OpenPersistenceManagerInViewInterceptor()
public void setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory pmf)
public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
public void preHandle(org.springframework.web.context.request.WebRequest request) throws org.springframework.dao.DataAccessException
preHandle
in interface org.springframework.web.context.request.WebRequestInterceptor
org.springframework.dao.DataAccessException
public void postHandle(org.springframework.web.context.request.WebRequest request, org.springframework.ui.ModelMap model)
postHandle
in interface org.springframework.web.context.request.WebRequestInterceptor
public void afterCompletion(org.springframework.web.context.request.WebRequest request, Exception ex) throws org.springframework.dao.DataAccessException
afterCompletion
in interface org.springframework.web.context.request.WebRequestInterceptor
org.springframework.dao.DataAccessException
protected String getParticipateAttributeName()
PARTICIPATE_SUFFIX