You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2010/03/30 13:00:33 UTC

[jira] Commented: (CAY-1410) Handle subsequent delete/insert of records with matching meaningful or propagated PK

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

Andrus Adamchik commented on CAY-1410:
--------------------------------------

actually UPDATE is only needed if the entity has extra non-pk columns, otherwise no operation should be performed at all.

> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.