Spring web request interceptor that binds a JPA EntityManager to the thread for the entire processing of the request. Intended for the "Open EntityManager in View" pattern, i.e. to allow for lazy loading in web views despite the original transactions already being completed.
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 {@link org.springframework.orm.jpa.JpaTransactionManager}or {@link org.springframework.transaction.jta.JtaTransactionManager} as wellas for non-transactional read-only execution.
In contrast to {@link 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 {@link org.springframework.orm.jpa.JpaAccessor}, to be configured in a bean definition.
@author Juergen Hoeller
@since 2.0
@see OpenEntityManagerInViewFilter
@see org.springframework.orm.jpa.JpaInterceptor
@see org.springframework.orm.jpa.JpaTransactionManager
@see org.springframework.orm.jpa.JpaTemplate#execute
@see org.springframework.orm.jpa.SharedEntityManagerCreator
@see org.springframework.transaction.support.TransactionSynchronizationManager