Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EntityManagerFactory

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using O'Rel EJB 3.0. At one time the book says that in EE EntityManagerFactory.close() should not called as it would throw IllegalStateException. But in another instance, it says that, developer could forget to close() an entity manager & leake resources. So is EntityManagerFactory called automatically or not.

Thanks
 
Moayad Abu Jaber
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application server is close it automatically.
Java EE container is managed environment.


Best Regards,
Moayad Abu Jaber
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to reply above, the Persistence can be used inside container , or outside container .

You only call EntityManagerFactory.close when you are doing it outside the container.
 
Moayad Abu Jaber
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Dear thanks for your additional explanation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic