openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gokhan Ergul (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-231) Incorrect handling of cascading bidirectional collections during merge/attach
Date Fri, 20 Jul 2007 03:13:06 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514084
] 

Gokhan Ergul commented on OPENJPA-231:
--------------------------------------

That'll do too, but still we'd need the isManaged() check to fix OPENJPA-255 as well, see
https://issues.apache.org/jira/secure/attachment/12359302/openjpa-jira-255.patch.

> Incorrect handling of cascading bidirectional collections during merge/attach
> -----------------------------------------------------------------------------
>
>                 Key: OPENJPA-231
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-231
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 0.9.7
>         Environment: platform-independent
>            Reporter: Gokhan Ergul
>         Attachments: jira-test-case.zip, openjpa-231.patch
>
>
> As posted on open-jpa-dev mailing list:
> -----
> I'm having a problem merging an entity, here's the simplified structure:
> Class A {     @OneToMany(cascade=CascadeType.ALL, mappedBy="parent")
>    Set<B> b_set;
>    ...
> }
> Class B {
>    @ManyToOne
>    A parent;
>    @OneToMany(cascade=CascadeType.ALL, mappedBy="parent")
>    Set<C> c_set;
>    ...
> }
> Class C {
>    @ManyToOne
>    B parent;
>    ...
> }
> New instances of A,B,C are persisted correctly. However when I retrieve A, add some entries
to A.b_set (with some of the new B entries have attached C's), em.merge(A) fails:
> - If A is detached:
>     org.apache.openjpa.persistence.ArgumentException: Encountered new object "B@..."
in persistent field "C.parent" of managed object "C@..." during attach.  However, this field
does not allow cascade attach.  You cannot attach a reference to a new object without cascading.
> - If A is not detached:
>                  C instances are inserted before B instances, resulting in a foreign
key violation.
> Setting openjpa.jdbc.SchemaFactory to 'native(ForeignKeys=true)' does not seem to have
an effect.
> ----

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