Hi Pinaki The id is generated through the oracle sequence, so the id is not know till the SQLs are generated.
The problem being having the addrId and Address having mapped to the one column ADDR_FK_ID of the Phone table as we wanted the old way of using the AddrId and new way of Address to work. When i do the one direction from Address to Phone, it says we are trying to set two different values to same object. For this case for the AddrId column mapping it sets null and for the Address mapping it sets the Address primary key. When I do the bidirectional mapping, the insert statements to Phone has addrId columns twice one for the AddrId and other for Address. It says the duplicate column in the insert statement. I am looking at the possibility of POJOs supporting the old and new way of persistence. Hope you got what i am trying to explain. Rgds Madhu Pinaki Poddar wrote: > > Hi, > The mapping you described originally in this post should work as well. > Of course, the application must set the values of ADDR_FK_ID from both > sides consistently. > For example, if there is one Address instance A1 with id 12345 and > A1.phones is a Set that contains two Phone instances P1 and P2. Then the > application must ensure that for both P1 and P2 addressId field is set to > 12345 before commit. The problem will be complicated only if Address has > auto-generated identity. > -- View this message in context: http://n2.nabble.com/OpenJPA---two-sided-relation-between-objects-Issue-tp687050p720633.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
