You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (Closed) (JIRA)" <ji...@apache.org> on 2012/02/03 18:09:53 UTC

[jira] [Closed] (OPENJPA-2006) Sequence generated ids may fail to get assigned when flushing a graph with bi-directional relationships

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

Albert Lee closed OPENJPA-2006.
-------------------------------

    
> Sequence generated ids may fail to get assigned when flushing a graph with bi-directional relationships
> -------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2006
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2006
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.2.2, 2.1.0, 2.2.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>             Fix For: 1.2.3, 2.0.2, 2.1.2, 2.2.0
>
>         Attachments: OPENJPA-2006.1.2.x.patch
>
>
> Flushing a multi-level graph with many bi-directional relationships can result in SQL exceptions due to sequence-generated IDs of some leaf entities not getting assigned during pre-flush.  Sequence-generated id's require an additional ID population step which happens during pre-flush.  OpenJPA's state transitioning during a pre-flush can fail to pre-flush child entities when certain bi-directional traversals occur.  The proposed fix is if flushing, perform the pre-flush on entities that may have moved from provisional to new state (as a result of a previous traversal) without being properly pre-flushed.  If the entity was previously pre-flushed, it will have been tagged as such and the operation will simply return.  Otherwise, it'll pre-flush the entity and all child entities, generating IDs in the process.  On Oracle, the SQL exception below is a symptom of the problem.  An ID has not been assigned to an entity and as a result, OpenJPA is attempting to insert NULL into an ID field.
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-01400: cannot insert NULL into ("SCOTT"."FL_ASSIGN"."ASSIGN_ID")
>  {prepstmnt 577905266 INSERT INTO FL_ASSIGN (ASSIGN_ID, ASSIGN_TEXT, TOPIC_ID) VALUES (?, ?, ?) [params=?, ?, ?]} [code=1400, state=23000]

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