kundera icon indicating copy to clipboard operation
kundera copied to clipboard

When we use kundera With springs which is better injecting EntityManagerFactory or Injecting the Entitymanger?

Open Gargee opened this issue 13 years ago • 1 comments

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.

Gargee avatar Jun 20 '13 23:06 Gargee

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

mevivs avatar Jun 21 '13 17:06 mevivs