openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryl Stultz" <>
Subject Re: EntityManager handling
Date Mon, 22 Dec 2008 20:06:41 GMT
> 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.'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

Thanks for your help.

Daryl Stultz
6 Degrees Software and Consulting, Inc.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message