cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CAY-1410) Handle subsequent delete/insert of records with matching meaningful or propagated PK
Date Tue, 30 Mar 2010 10:54:27 GMT

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

Andrus Adamchik updated CAY-1410:
---------------------------------

    Description: 
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.


  was:
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 is 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.



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


Mime
View raw message