• Post Reply Bookmark Topic Watch Topic
  • New Topic

Obtaining a PersistenceContext in Java EE  RSS feed

 
Ranch Hand
Posts: 10128
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,



 
Ranch Hand
Posts: 856
  • 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: 10128
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?
 
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!