openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject RE: How to persist then update in same transaction
Date Tue, 01 Sep 2009 18:30:59 GMT
Hi Daryl, 

I've moved one of my new apps to hibernate as I said I was going to, but I
also have a smaller less time critical app I am still using OpenJPA for,
this is the one where I see the behaviour described below. It's quite easy
to reproduce, basically it works like this:

Create an instance of the entity manager (1) and retrieve an "Invoice"
Create a new instance of the entity manager (2) and retrieve an
"InvoiceLine" entity. The Invoice entity has a collection of InvoiceLine
entities in a member named "lines", which is set to ManyToOne and cascade
refresh. Now add this retrieved InvoiceLine to the Invoice "lines"
collection in the Invoice entity.  
Close the entity manager (2) which should now make the InvoiceLine entity

Now call merge on he Invoice entity using the first entity manager (1).
It'll always complain that the Invoiceline entity is not managed by the

Hope I explained that ok. 


-----Original Message-----
From: Daryl Stultz [] 
Sent: Wednesday, 2 September 2009 1:51 AM
Subject: Re: How to persist then update in same transaction

On Tue, Sep 1, 2009 at 1:39 PM, C N Davies <> wrote:

> What I find is

Chris, I thought you and I were done trying to figure out if my error
condition is the same as yours! I'm intrigued by this new information of
yours. Can you provide a simple code sketch that illustrates the problem you
are having?

Daryl Stultz
6 Degrees Software and Consulting, Inc.

View raw message