openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteve Boix <eb...@esteveb.com>
Subject Re: Update & OneToMany
Date Mon, 13 Aug 2007 10:39:26 GMT

Hi there again,

Just for the record: I finally set up a couple of simple tests, and I've
came to the conclusion that this is my fault (as I suspected :) ).

When I run my DAOs in the test cases, using the Spring context all goes
well. The problem arises when I use the DAOs in a MINA's handler (just
for info: a MINA handler is like a Servlet, but for network connections,
not just HTTP. It's similar in that it has callbacks, a session object,
etc...).

Well, if I run the DAO inside a MINA handler, when I persist an object
that have a OneToMany relation, the "id" fields of the child objects are
not updated, so in the next update, OpenJPA inserts again the entities
(which, again don't get their id fields updated). Strange.

I've noticed that each method in the handler is called my a different
thread. I've tried "openjpa.multithreaded=true", but makes not difference.

I'll come back to you when I find what's going on.

Best regards,
Esteve

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
>>
>>     
>
>
> Notice:  This email message, together with any attachments, may contain information 
of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,
 proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use
of the individual or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this by email and then
delete it.
>
>
>   


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