This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EM and Persistence Contexts  RSS feed

 
Mohammad Jaber
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Does Each EntityManager have only one PersistenceContext , and does that requires only transaction per PersistenceContext !???

Thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes there is only one persistence context in an EntityManager or Session object. it is a has a relationship.

Mark
 
Antero Laukkanen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..and as long as the entity managers come from the same factory, the persistence context is the same..?
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Antero Laukkanen:
..and as long as the entity managers come from the same factory, the persistence context is the same..?

They will only be the same if the entity managers are both container-managed and were obtained in the same transaction.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!