public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAccessor implements WebRequestInterceptor
This interceptor makes JPA EntityManagers available via the current thread,
which will be autodetected by transaction managers. It is suitable for service
layer transactions via
JtaTransactionManager as well
as for non-transactional read-only execution.
In contrast to
OpenEntityManagerInViewFilter, this interceptor
is set up in a Spring application context and can thus take advantage of
bean wiring. It inherits common JPA configuration properties from
JpaAccessor, to be configured in a
|Modifier and Type||Field and Description|
Suffix that gets appended to the EntityManagerFactory toString representation for the "participate in existing entity manager handling" request attribute.
|Constructor and Description|
|Modifier and Type||Method and Description|
Callback after completion of request processing, that is, after rendering the view.
Return the name of the request attribute that identifies that a request is already filtered.
Intercept the execution of a request handler after its successful invocation, right before view rendering (if any).
Intercept the execution of a request handler before its invocation.
createEntityManager, getEntityManagerFactory, getJpaPropertyMap, getPersistenceUnitName, getTransactionalEntityManager, setBeanFactory, setEntityManagerFactory, setJpaProperties, setJpaPropertyMap, setPersistenceUnitName
public void preHandle(WebRequest request) throws DataAccessException
Allows for preparing context resources (such as a Hibernate Session) and expose them as request attributes or as thread-local objects.
public void postHandle(WebRequest request, ModelMap model)
Allows for modifying context resources after successful handler execution (for example, flushing a Hibernate Session).
public void afterCompletion(WebRequest request, java.lang.Exception ex) throws DataAccessException
Note: Will only be called if this interceptor's
method has successfully completed!
protected java.lang.String getParticipateAttributeName()