You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by "Anthony Carlucci (JIRA)" <ji...@apache.org> on 2012/06/15 20:00:43 UTC

[jira] [Created] (RAVE-680) Rave is not generating Foreign Keys with default JPA implementation

Anthony Carlucci created RAVE-680:
-------------------------------------

             Summary: Rave is not generating Foreign Keys with default JPA implementation
                 Key: RAVE-680
                 URL: https://issues.apache.org/jira/browse/RAVE-680
             Project: Rave
          Issue Type: Bug
            Reporter: Anthony Carlucci


Rave is not generating any foreign keys as part of the default OpenJPA implementation.

Steps:
1) Start up Rave using the default H2 database
2) Log into H2 web console http://localhost:11111
3) Execute: DELETE FROM WIDGET;  COMMIT;

Step 3 should throw a foreign key constraint error because widget_id is referenced in other tables, but it allows the deletes.  I also verified in an Oracle installation that there are zero foreign key constraints in the schema.  There are primary, check, and unique constraints but no foreign key constraints.

It appears that the default OpenJPA behavior[1] is to NOT create foreign keys (ugh), but this can be modified with a property:

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

[1] http://openjpa.apache.org/faq.html#FAQ-WhyOpenJPAisnotcreatingforeignkeyconstraintsonthedatabasetables%253F



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Resolved] (RAVE-680) Rave is not generating Foreign Keys with default JPA implementation

Posted by Aaron Gooch <eo...@gmail.com>.
+1

On Mon, Jun 18, 2012 at 5:18 PM, Anthony Carlucci (JIRA) <ji...@apache.org>wrote:

>
>     [
> https://issues.apache.org/jira/browse/RAVE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Anthony Carlucci resolved RAVE-680.
> -----------------------------------
>
>       Resolution: Fixed
>    Fix Version/s: 0.13
>         Assignee: Anthony Carlucci
>
> Fixed and checked in.  Some additional good news - this fix will also
> apply the Foreign Key constraints to an existing Rave schema as well as a
> new one.  I verified against an existing Oracle Rave schema that they got
> applied (it actually found a data issue in our USER_AUTHORITIES table).
>
> > Rave is not generating Foreign Keys with default JPA implementation
> > -------------------------------------------------------------------
> >
> >                 Key: RAVE-680
> >                 URL: https://issues.apache.org/jira/browse/RAVE-680
> >             Project: Rave
> >          Issue Type: Bug
> >            Reporter: Anthony Carlucci
> >            Assignee: Anthony Carlucci
> >             Fix For: 0.13
> >
> >
> > Rave is not generating any foreign keys as part of the default OpenJPA
> implementation.
> > Steps:
> > 1) Start up Rave using the default H2 database
> > 2) Log into H2 web console http://localhost:11111
> > 3) Execute: DELETE FROM WIDGET;  COMMIT;
> > Step 3 should throw a foreign key constraint error because widget_id is
> referenced in other tables, but it allows the deletes.  I also verified in
> an Oracle installation that there are zero foreign key constraints in the
> schema.  There are primary, check, and unique constraints but no foreign
> key constraints.
> > It appears that the default OpenJPA behavior[1] is to NOT create foreign
> keys (ugh), but this can be modified with a property:
> > <property name="openjpa.jdbc.MappingDefaults"
> value="ForeignKeyDeleteAction=restrict,
> JoinForeignKeyDeleteAction=restrict"/>
> > [1]
> http://openjpa.apache.org/faq.html#FAQ-WhyOpenJPAisnotcreatingforeignkeyconstraintsonthedatabasetables%253F
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators:
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>

[jira] [Commented] (RAVE-680) Rave is not generating Foreign Keys with default JPA implementation

Posted by "Anthony Carlucci (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/RAVE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13395957#comment-13395957 ] 

Anthony Carlucci commented on RAVE-680:
---------------------------------------

So far my simple smoke tests are working fine (page manipulation, widget manipulation, etc).  However I am getting errors trying to delete users as some of the data tied to a user is not getting cascaded properly (GROUP_MEMBERS for example) .  I'll update the code as necessary and make sure to run the full integration test suite before I check in this change.
                
> Rave is not generating Foreign Keys with default JPA implementation
> -------------------------------------------------------------------
>
>                 Key: RAVE-680
>                 URL: https://issues.apache.org/jira/browse/RAVE-680
>             Project: Rave
>          Issue Type: Bug
>            Reporter: Anthony Carlucci
>
> Rave is not generating any foreign keys as part of the default OpenJPA implementation.
> Steps:
> 1) Start up Rave using the default H2 database
> 2) Log into H2 web console http://localhost:11111
> 3) Execute: DELETE FROM WIDGET;  COMMIT;
> Step 3 should throw a foreign key constraint error because widget_id is referenced in other tables, but it allows the deletes.  I also verified in an Oracle installation that there are zero foreign key constraints in the schema.  There are primary, check, and unique constraints but no foreign key constraints.
> It appears that the default OpenJPA behavior[1] is to NOT create foreign keys (ugh), but this can be modified with a property:
> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
> [1] http://openjpa.apache.org/faq.html#FAQ-WhyOpenJPAisnotcreatingforeignkeyconstraintsonthedatabasetables%253F

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (RAVE-680) Rave is not generating Foreign Keys with default JPA implementation

Posted by "Jasha Joachimsthal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/RAVE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393694#comment-13393694 ] 

Jasha Joachimsthal commented on RAVE-680:
-----------------------------------------

Please check if you're able to delete profiles and/or widgets once the foreign keys are in place.

We have a circular reference: person -> page -> region -> regionwidget -> widget -> person
                
> Rave is not generating Foreign Keys with default JPA implementation
> -------------------------------------------------------------------
>
>                 Key: RAVE-680
>                 URL: https://issues.apache.org/jira/browse/RAVE-680
>             Project: Rave
>          Issue Type: Bug
>            Reporter: Anthony Carlucci
>
> Rave is not generating any foreign keys as part of the default OpenJPA implementation.
> Steps:
> 1) Start up Rave using the default H2 database
> 2) Log into H2 web console http://localhost:11111
> 3) Execute: DELETE FROM WIDGET;  COMMIT;
> Step 3 should throw a foreign key constraint error because widget_id is referenced in other tables, but it allows the deletes.  I also verified in an Oracle installation that there are zero foreign key constraints in the schema.  There are primary, check, and unique constraints but no foreign key constraints.
> It appears that the default OpenJPA behavior[1] is to NOT create foreign keys (ugh), but this can be modified with a property:
> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
> [1] http://openjpa.apache.org/faq.html#FAQ-WhyOpenJPAisnotcreatingforeignkeyconstraintsonthedatabasetables%253F

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (RAVE-680) Rave is not generating Foreign Keys with default JPA implementation

Posted by "Anthony Carlucci (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAVE-680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Carlucci resolved RAVE-680.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.13
         Assignee: Anthony Carlucci

Fixed and checked in.  Some additional good news - this fix will also apply the Foreign Key constraints to an existing Rave schema as well as a new one.  I verified against an existing Oracle Rave schema that they got applied (it actually found a data issue in our USER_AUTHORITIES table).
                
> Rave is not generating Foreign Keys with default JPA implementation
> -------------------------------------------------------------------
>
>                 Key: RAVE-680
>                 URL: https://issues.apache.org/jira/browse/RAVE-680
>             Project: Rave
>          Issue Type: Bug
>            Reporter: Anthony Carlucci
>            Assignee: Anthony Carlucci
>             Fix For: 0.13
>
>
> Rave is not generating any foreign keys as part of the default OpenJPA implementation.
> Steps:
> 1) Start up Rave using the default H2 database
> 2) Log into H2 web console http://localhost:11111
> 3) Execute: DELETE FROM WIDGET;  COMMIT;
> Step 3 should throw a foreign key constraint error because widget_id is referenced in other tables, but it allows the deletes.  I also verified in an Oracle installation that there are zero foreign key constraints in the schema.  There are primary, check, and unique constraints but no foreign key constraints.
> It appears that the default OpenJPA behavior[1] is to NOT create foreign keys (ugh), but this can be modified with a property:
> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
> [1] http://openjpa.apache.org/faq.html#FAQ-WhyOpenJPAisnotcreatingforeignkeyconstraintsonthedatabasetables%253F

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira