openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Defoy" <>
Subject Embedded entities are deleted last
Date Thu, 28 Jun 2007 17:42:28 GMT

I am trying to get the existing object model from our system to
persist correctly with openjpa.  Here's the situation.

I have an object A that contains a link to objects B and C.  A will
contain either a link to B or a link to C, never to both.  I tried two
approaches with openjpa to persist object A: one-to-one relationship
to B and to C and declaring B and C as embedded entities of A.  Both
approaches worked fine except that with the embedded entities I ran
into two problems I was not able to resolve:

1. I was not able to specify the name of the key for tables containing
B and C.  The generated names were: B_id and C_id but the actual value
is the id of A...  Is there a way to specify the name of the column
for that value?

2. When I tried to delete object A, I got a constraint violation since
objects B and C are not deleted yet (there is a foreign key in the DB
for this).  Is it normal that B and C are deleted after A since they
do not have a life of their own?

By the way, I am using Hypersonic version and the latest
official release of openjpa (0.9.7).

Thanks in advance!


View raw message