openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2199) Constraint violation exception when removing relationship using (orphanRemoval = true)
Date Fri, 18 May 2012 15:19:09 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee updated OPENJPA-2199:
--------------------------------

    Affects Version/s: 2.3.0
        Fix Version/s: 2.2.1
                       2.3.0
                       2.1.2
                       2.0.3
    
> Constraint violation exception when removing relationship using (orphanRemoval = true)
> --------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2199
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2199
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.0.0, 2.1.0, 2.2.0, 2.3.0
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>             Fix For: 2.0.3, 2.1.2, 2.3.0, 2.2.1
>
>
> The problem occurs with the following relationships between classes:
> Parent ->* Child ->* GrandChild. Class Parent has a collection of Childs.
> Class Child has a collection of GrandChilds.
> Each one-to-many relationship is annotated like this: @OneToMany(cascade = CascadeType.
> ALL, orphanRemoval = true, ...). I.e. we use orphan removal and remove operations cascade
from parents to children and grandchildren.
> When we do the following a DB constraint violation occurs:
> 1) Start a transaction
> 2) Load a Parent instance from the database
> 3) Navigate to a Child and modify it
> 4) Cut the relationship between Child and GrandChild
> 5) Cut the relationship between Parent and Child
> 6) Commit the transaction
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DELETE on table 'JPAORPHAN_CHILD'
caused a violation of foreign key constraint 'SQL120320110237861' for key (11).  The statement
has been rolled back. {prepstmnt 1074806800 DELETE FROM APP.JPAORPHAN_CHILD WHERE ID = ? [params=(int)
11]} [code=20000, state=23503]

--
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

        

Mime
View raw message