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

David Jencks updated GERONIMO-5293:
-----------------------------------

        Summary: OpenJPA in Geronimo fails to order SQL INSERT statements so 
that FK are not violated (complex objects and EntityManager.persit())  (was: 
Geronimo Transaction Manager fails to order SQL INSERT statements so that FK 
are not violated (complex objects and EntityManager.persit()))
    Component/s: persistence

I've renamed this issue since the tx manager has nothing to do with ordering 
work on a resource manager.

I think this is most likely a configuration issue.  I think there is a 
configuration parameter that tells openjpa to order sql statements to respect 
possible foreign key constraints, and perhaps it is not set by default in 
geronimo.

Are you letting openjpa create the tables on startup in all cases?  If so, are 
the same foreign key constraints created in each case?  If not, can you try to 
let openjpa create the tables and see if the same foreign keys are created?

> OpenJPA in Geronimo fails to order SQL INSERT statements so that FK are not 
> violated (complex objects and EntityManager.persit())
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-5293
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5293
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: persistence
>    Affects Versions: 2.1.3, 2.1.4
>         Environment: Windows XP
>            Reporter: Ɓukasz Budnik
>            Priority: Critical
>
> Geronimo Transaction manager fails to order SQL INSERT statements so that FK 
> are not violated.
> Assume you have 4 entities. A, B, C, and X.
> All A, B, C have a FK pointing to X. A has many B (B has FK pointing to A). B 
> has many C (C has FK pointing to B).
> In JPA it's mapped as: A has list of B, and a field of type X, B has a list 
> of C, and a field of type X, and finally C has a field of type X.
> I'm persisting object A, and all inserts are propagated. OpenJPA 1.0.3 (used 
> in Geronimo 2.1.3) and OpenJPA 1.2.1 (used in 2.1.4) does it without any 
> problems, Geronimo fails to do so.
> The correct answer is:
>    1. persist all X objects, retrieve theirs PK
>    2. insert A object, insert X FK, retrieve PK of newly created record
>    3. insert all B objects, insert X and A FK respectively, retrieve PK of 
> newly created records
>    4. insert all C objects, insert X and B FK respectively, retrieve PK of 
> newly created records
> thanks,
> Lukasz

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

Reply via email to