On Wed, Jul 1, 2009 at 10:39 AM, ljnelson <[email protected]> wrote:

>
> You need to follow this pattern when merging:
>
> final X newThing = em.merge(oldThing);
>
> ...and then "throw out" oldThing, since it is effectively no longer valid.
>
>
The merge is effectively the end of the "operational transaction" so I don't
really care that the original is no good. What I'm doing is this:

get managed entity X
detach X by closing em
edit properties of X
get new em
begin em transaction
merge X
commit em transaction
walk away

What's done at "edit properties" is not sent to the database on commit.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to