This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Obtaining a PersistenceContext in Java EE

 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

What is the deal with obtaining a PersistenceContext using @PersistencContext annotation and what difference or a performance overhead it is when I say the following,



 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the first one is managed by the application and the second one by container.

So you can conclude the container managed persistence context is more efficient in it's operation's.
 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But even in the line,



it is the contaner that performs the DI. So dosn't that mean that it is managed by the container?
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case the entity manager factory is managed by the container, but not the entity manager itself.

As a remark concerning performance aspects: I was once told on glassfish forum that creating an entity manager is a lightweight operation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic