Servlet Filter 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 filter makes JPA EntityManagers available via the current thread,
which will be autodetected by transaction managers. It is suitable for service
layer transactions via JpaTransactionManager
or JtaTransactionManager as well
as for non-transactional read-only execution.
Looks up the EntityManagerFactory in Spring's root web application context.
Supports an "entityManagerFactoryBeanName" filter init-param in web.xml;
the default bean name is "entityManagerFactory". As an alternative, the
"persistenceUnitName" init-param allows for retrieval by logical unit name
(as specified in persistence.xml).
Return the bean name of the EntityManagerFactory to fetch from Spring's
root application context.
public void setPersistenceUnitName(@Nullable
Set the name of the persistence unit to access the EntityManagerFactory for.
This is an alternative to specifying the EntityManagerFactory by bean name,
resolving it by its persistence unit name instead. If no bean name and no persistence
unit name have been specified, we'll check whether a bean exists for the default
bean name "entityManagerFactory"; if not, a default EntityManagerFactory will
be retrieved through finding a single unique bean of type EntityManagerFactory.