openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhu Kalaimalai <mba...@yahoo.com>
Subject Re: OpenJPA - two-sided relation between objects Issue
Date Wed, 13 Aug 2008 23:23:38 GMT

Hi Pinaki

When i tried with the implicit option you suggested, it gave me the
following error

Caused by: <4|true|0.9.5-incubating>
org.apache.openjpa.persistence.ArgumentException:
"gov.ccms.entity.Phone.addrId" is marked as having a foreign key, but
OpenJPA does not support a foreign key on this mapping in this context.

When you flush the address and then create the phone and add the address
identity to the phone and add this phone to address and commit . This works.

It is the same way as the old code does which we would not like to do going
forward

The point i am trying is make the old code work with out refactoring and
bring in the relation and use object graph persistence.

Thanks for your inputs

Rgds
Madhu


Pinaki Poddar wrote:
> 
> Hi,
>   The use case you have presented can be supported with some twists.
> Follow the steps described below:
> Approach A:
> 1. Remove all phones from Address, but remember them
> 2. flush() the Address.
> 3. Database will now assign identity to Address
> 4. Add the phones back and set each phone's identifier to the newly
> assigned identifier of the Address
> 5. commit
> 
>   Did you try this?
>   If yes, what did you see?
> 

-- 
View this message in context: http://n2.nabble.com/OpenJPA---two-sided-relation-between-objects-Issue-tp687050p723041.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message