> > True. But closing EntityManager essentially will clear up its cache. For a > higher performance, consider *not* closing EntityManager and pooling them, > provided your application semantics allows for reuse of cached persistence > instances from a different transaction.
Yikes! This is getting more complicated than I am prepared for. Where can I find information on the best way to manage/pool EMs? > > > > It seems the EM can detect when 2 objects representing the same row in > the > > Not exactly. Let us say database has a row in PERSON table with primary key > 'X'. > > Effectively, JVM now has two separate Java instances p1 and p2 in two > separate caches of em1 and em2. Yes I get how 2 instances of the same row can be had, but... > > If both em1 and em2 modify p1 and p2 respectively and attempts commit, then > the later commit will fail. ...it's obviously not the EM instance that detects the concurrent mod, since the 2 instances are in different EMs. What is the mechanism that does the detection? Thanks for your help. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:[email protected]
