• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Entity Manager and Persistence Context

 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
While going through the JPA Specs (Page 130) , I came across the statement below.


If there is a different persistence context already associated with the JTA transaction, the container throws the EJBException.



If this is the case and I am working with two different Entity Managers pointing to two different Databases , will such operation fail?
Consider a use case in which a session bean method is interacting with two databases (2 phase commit). In this case I would have two EntityManager references. As per the statement above doing so could fail so I am a bit confused about how to achieve this?

Hope I am putting my question correctly as I myself is confused after reading this statement.

Or does the spec say or trying to say - different persistence context but for same database.

Thanks,
Amit
 
reply
    Bookmark Topic Watch Topic
  • New Topic