Hi Adam -

JIRA-39 is pretty old. Possibly JIRA-1004 is related to your question? There 
was recent discussion on this list about this.

Also there was recent mention on this list of using either one of these settings regarding ordering of operations (reading the docs leaves me with some questions about what these do).

 <property name="openjpa.jdbc.Schemafactory" value="native(ForeignKeys=true)"/>

 <property name="openjpa.jdbc.UpdateManager" value="operation-order"/>

It seems like by default (this is just my observation) OpenJPA manages "effective" foreign key behavior without actually generating foreign keys when it does forward mapping. If you have existing foreign keys on a database or the database is updated by non-JPA clients then you might need to apply annotations and configuration to account for that.

What I found in my app is that OpenJPA generates (forward mapping) indices that work the way foreign keys do, except that OpenJPA manages the relationships rather than having the database do it with foreign keys. For instance I found that OpenJPA by default does "effective" cascade delete on ManyToMany relations. This surprised me a little since I did not find where that is in the spec (this is the sensible default behavior though).

Perhaps others can enlighten on these issues further :-)

- Paul

On 4/12/2009 7:31 PM, Adam Hardy wrote:
Just wanted to check that this old issue still describes the situation properly:

http://issues.apache.org/jira/browse/OPENJPA-39
Cascade delete does not work with foreign key constraints

- marked as 'resolved - wont fix'.

Just wondering if maybe in the in-between time something has been implemented for this.

I'm trying to do exactly this (delete a large part of my object model cascading down several parent-child relationships) but I can't get it to work.


Regards
Adam




Reply via email to