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

when to close the EntityManager

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,
just a quick question, on an entity bean, should the EntityManager closed everytime a method return a query result or left open?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using dependency injection and letting the App Server do that for you, then you do not have to open or close the EntityManager, the App Server handles all that for you, opening, committing or rolling back and also closing the EM.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic