openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteve Boix <>
Subject Re: Update & OneToMany
Date Fri, 10 Aug 2007 15:47:38 GMT

Thanks for your fast response.

I'm attaching the simplified relevant entites (no getters/setters and no
irrelevant fields).

The TemporalMessage have a OneToOne mapping to an address (guess it, the
"Mail from:" :) ) and a OneToMany mapping to the same table (the "Rcpt

- I'm attaching the logs of what OpenJPA is doing.
- I'm always accessing the collection (a List, actually) via the List
interface, not using the setter to create a new List. I simply .add()
new addresses and then I update the TemporalMessage.
- The database is Derby in Client-Server mode.

Best regards,

PS: I'm attaching this as ZIP to try to circumvent the anti-ucm filter that
keeps rejecting this mail...

En/na David Ezzio ha escrit:
> Hi Esteve,
> Doesn't sound normal.  Can you give us more info?  Some questions that 
> may help you understand what is going on.
> What are all the annotations for the OneToMany relationship?
> If Entity1 has a simple value attribute and you update that, does the 
> same behavior occur for the association?
> Is it possible that you have assigned a new collection to your field, 
> instead of modifying the existing collection?  If so, does the behavior 
> change if you change your application to modify the existing collection?
> HTH,
> David Ezzio
> Esteve Boix wrote:
>> Hi all,
>> I'm observing the following behaviour, and I'd like to know if it's
>> normal or if it's a config problem:
>> I have an Entity1 with a @OneToMany relation to Entity2, using a table
>> to link both entities. Everytime I update Entity1, OpenJPA deletes all
>> the links from the link table and recreates all the entities Entity2.
>> This is weird cause I end up with a lot of orphaned Entity2 objects
>> (OpenJPA clears the links, but not the original entities).
>> Regards,
>> Esteve

View raw message