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 org.
or org. 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.
OpenEntityManagerInViewFilter, org.springframework.orm.jpa.JpaTransactionManager , org.springframework.orm.jpa.SharedEntityManagerCreator , org.springframework.transaction.support.TransactionSynchronizationManager
| Modifier and Type | Field and Description |
|---|---|
| public static final String | PARTICIPATE_SUFFIX
Suffix that gets appended to the EntityManagerFactory toString representation for the "participate in existing entity manager handling" request attribute. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterCompletion(WebRequest
the current web request request, Exception exception thrown on handler execution, if any ex)Implements org. Callback after completion of request processing, that is, after rendering the view. |
| public void | afterConcurrentHandlingStarted(WebRequest
the current request request)Implements org. Called instead of |
| private boolean | |
| private boolean | |
| protected String | getParticipateAttributeName()
Return the name of the request attribute that identifies that a request is already filtered. |
| public void | postHandle(WebRequest
the current web request request, ModelMap the map of model objects that will be exposed to the view
(may be model)null). Can be used to analyze the exposed model
and/or to add further model attributes, if desired.Implements org. Intercept the execution of a request handler after its successful invocation, right before view rendering (if any). |
| public void | preHandle(WebRequest
the current web request request)Implements org. Intercept the execution of a request handler before its invocation. |
| PARTICIPATE_SUFFIX | back to summary |
|---|---|
| public static final String PARTICIPATE_SUFFIX Suffix that gets appended to the EntityManagerFactory toString representation for the "participate in existing entity manager handling" request attribute.
| |
| OpenEntityManagerInViewInterceptor | back to summary |
|---|---|
| public OpenEntityManagerInViewInterceptor() | |
| afterCompletion | back to summary |
|---|---|
| public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException Implements org. Doc from org. Callback after completion of request processing, that is, after rendering the view. Will be called on any outcome of handler execution, thus allows for proper resource cleanup. Note Will only be called if this interceptor's
| |
| afterConcurrentHandlingStarted | back to summary |
|---|---|
| public void afterConcurrentHandlingStarted(WebRequest request) Implements org. Doc from org. Called instead of
| |
| applyEntityManagerBindingInterceptor | back to summary |
|---|---|
| private boolean applyEntityManagerBindingInterceptor(WebAsyncManager asyncManager, String key) | |
| decrementParticipateCount | back to summary |
|---|---|
| private boolean decrementParticipateCount(WebRequest request) | |
| getParticipateAttributeName | back to summary |
|---|---|
| protected String getParticipateAttributeName() Return the name of the request attribute that identifies that a request is already filtered. Default implementation takes the toString representation of the EntityManagerFactory instance and appends ".FILTERED".
| |
| postHandle | back to summary |
|---|---|
| public void postHandle(WebRequest request, ModelMap model) Implements org. Doc from org. Intercept the execution of a request handler after its successful invocation, right before view rendering (if any). Allows for modifying context resources after successful handler execution (for example, flushing a Hibernate Session).
| |
| preHandle | back to summary |
|---|---|
| public void preHandle(WebRequest request) throws DataAccessException Implements org. Doc from org. Intercept the execution of a request handler before its invocation. Allows for preparing context resources (such as a Hibernate Session) and expose them as request attributes or as thread-local objects.
| |