openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: How to attach an existing, detached object to a new entity and save new entity?
Date Sun, 30 Dec 2007 18:36:22 GMT

Does Country object declare a @Version field?


mxc wrote:
> 
> Hi all,
> 
> In my application a user edits an entry in a form which allows the user to
> select the foreign objects from a list box which has been populated via a
> jpa query. (The context has been closed and hence the object is detached.)
> So for example if the object customer has a manytoone relationship to
> country the country drop down allows selection of the country.
> 
> When trying to persist the customer object I get an error about the
> country object already having an id value set and that this causes
> problems with auto-generation. It appears that openjpa is attemtping to
> persist the country object insead of just attaching it and seeing it is
> already in the database. How can I fix this? I have tried
> cascade={CascadeType.ALL} on both sides of the relationship with no luck
> :(
> 
> thanks
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-attach-an-existing%2C-detached-object-to-a-new-entity-and-save-new-entity--tp14545985p14549852.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message