My webapp contains many entityManagerFactories (DBs) , each has its unique name , such as entityManagerFactoryApp , entityManagerFactoryBusiness , entityManagerFactoryForum ...etc.
In a webapp , I have to add OpenEntityManagerInViewFilter to achieve "Open Session in View" pattern.
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
But when running , Spring complains NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined
But my EMFs are not named "entityManagerFactory" , I lookup OpenEntityManagerInViewFilter's code and find setEntityManagerFactoryBeanName()
method , but how should I set its value in web.xml ?
Moreover , I have multiple EMFs , shoild I define multiple OpenEntityManagerInViewFilter
s in web.xml ?
Thanks in advanced.
Environments : Spring 3.0.2 , Hibernate 3.5.1.Final , Resin 4.0.7 , JPA2 (hibernate-jpa-2.0-api)