openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Commented: (OPENJPA-435) Change mapping defaults to assume foreign keys exist for relationships by default
Date Tue, 06 Nov 2007 17:21:50 GMT


Patrick Linskey commented on OPENJPA-435:

I believe that this can be worked around in the short term by setting the MappingDefaults
ForeignKeyDeleteAction and JoinForeignKeyDeleteAction properties to 'restrict':

<property name="openjpa.jdbc.MappingDefaults"
    value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>

Could someone who is seeing this behavior in their app give this a try and comment on this
issue, please?

Of course, another workaround is to tell OpenJPA to look for foreign key constraints in the
database. This can be quite slow, though. FTR, you can do this like so:

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

> Change mapping defaults to assume foreign keys exist for relationships by default
> ---------------------------------------------------------------------------------
>                 Key: OPENJPA-435
>                 URL:
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 0.9.0, 0.9.6, 0.9.7, 1.0.0, 1.0.1, 1.0.2, 1.1.0
>            Reporter: Patrick Linskey
>             Fix For: 1.1.0
> OpenJPA's current defaults assume that no foreign keys exist. This leads to potentially
more optimal SQL ordering, but often also leads to FK constraint violations when obvious FKs
exist but are not declared. We should change this default to be more user-friendly, and add
a note to our optimization guide as appropriate if there are actions users should take to

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message