Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Appropiate place for creating and closing EntityManagerFactory in Application Managed EntityManager

Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am planning to use , Application Managed EntityManager for my web based Application . I have made this class for getting access to EntityManagaerFactory .

As Creating EntityManagerFactory are expensive

Will it be a good place to write a ServletContextListener for my Web based Application to create a EntityManagerFactory inside the ContextInitilized and call the close method inside the ContextDestroyed .

Please help .
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!