• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EM and Persistence Contexts

 
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: 17278
6
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic