cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ari Maniatis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-1410) Handle subsequent delete/insert of records with matching meaningful or propagated PK
Date Tue, 04 Mar 2014 00:47:22 GMT

    [ https://issues.apache.org/jira/browse/CAY-1410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13918838#comment-13918838
] 

Ari Maniatis commented on CAY-1410:
-----------------------------------

Andrus, this one bites us every so often. Do you think this is hard to fix since it goes to
the core of the commit sorting algorithm?

> Handle subsequent delete/insert of records with matching meaningful or propagated PK
> ------------------------------------------------------------------------------------
>
>                 Key: CAY-1410
>                 URL: https://issues.apache.org/jira/browse/CAY-1410
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: Short term future
>
>
> This situation often happens with join tables that don't have their own PK, and rely
on propagated PK from owning entities, however this can potentially be the case for any kind
of entities with non-autogenerated PK (e.g. those with meaningful PK), as well as implicitly
for flattened relationships (not sure if we handle those via a different mechanism). Here
is one common scenario:
> 1. Mapping: A - AB - B. AB's compound PK is propagated from both A and B. 
> 2. Steps:
>  
>    AB ab1;
>    context.deleteObject(ab); // relationships nullified on A&B sides via the delete
rule
>    ...
>    AB ab2 = context.newObject(AB.class);
>    a.addToAbs(ab2);
>    b.addtoAbs(ab2);
> 3. context.commitChanges() causes unique key exceptions as ab2 instered before ab1 is
deleted.
> Ideally here we should detect that an object being inserted has the same ObjectId as
another object being deleted, and should replace INSERT/DELETE pair with UPDATE.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message