openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willis Blackburn (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-435) Change mapping defaults to assume foreign keys exist for relationships by default
Date Sat, 25 Sep 2010 17:32:32 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914841#action_12914841
] 

Willis Blackburn commented on OPENJPA-435:
------------------------------------------

+1!

It doesn't seem logical to assume that FKs don't exist.

Reason #1:  They usually do!  Let's assume that people using OpenJPA are intelligent and are
designing production-quality databases.  Of course they're going to have FKs.

Reason #2:  The strategy of querying the database to discover the FKs seems at odds with the
general JPA strategy of declaring the database metadata in code.  We let the code define the
database, not vice-versa.

Reason #3:  It leads to the fewest surprises.  Consider:

    OpenJPA assumes FKs don't exist, and they don't:  OK
    OpenJPA assumes FKs don't exist, and they do:  FAIL!
    OpenJPA assumes FKs exist, and they don't:  No worries!
    OpenJPA assumes FKs exist, and they do:  OK



> Change mapping defaults to assume foreign keys exist for relationships by default
> ---------------------------------------------------------------------------------
>
>                 Key: OPENJPA-435
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-435
>             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.3.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
optimize.

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


Mime
View raw message