When we use kundera With springs which is better injecting EntityManagerFactory or Injecting the Entitymanger?
Hi , I am trying to integrate kundera with springs.Now i want to figure out which one is better 1.injecting the EntitymanagerFactory in my DAO 2.Injecting the Entitymanager
I want to know which is the best practice and which will help me achieve a more scalable application. Any simple working example will help.
Hi, Please refer https://github.com/impetus-opensource/kwitter for sample application. Also, you might need to comment out JTA specific configuration from appContext.xml. Also, a detailed description about "Injecting EM or EMF" can be found at:http://static.springsource.org/spring/docs/2.5.x/reference/orm.html#orm-jpa-straight
(Section 12.6.3 Implementing DAOs based on plain JPA)
Cost of creating EMF/thread is definitely expensive, where as creating EM/thread or request should be fine with Kundera.
-Vivek