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 2009/10/08 08:33:31 UTC

[jira] Commented: (CAY-1289) Order delete statements before insert statements when committing changes to the database

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

Andrus Adamchik commented on CAY-1289:
--------------------------------------

It is not that simple. Suggested fix will most certainly break other (arguably more common) cases. A few suggestions:

1. Instead of DELETE/INSERT pair, use UPDATE 
2. Use manual transaction to wrap two sequential ObjectContext commits - one to delete the objects, and another to insert the new ones. This will ensure the right commit order and atomic rollback:

http://cayenne.apache.org/doc/understanding-transactions.html



> Order delete statements before insert statements when committing changes to the database
> ----------------------------------------------------------------------------------------
>
>                 Key: CAY-1289
>                 URL: https://issues.apache.org/jira/browse/CAY-1289
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M6
>         Environment: Java 1.6, Windows XP, JBoss
>            Reporter: Patrick Mayweg
>
> When committing changes to the database, the delete statements should be excuted before the insert statements. 
> We often remove old objects and create new objects for the same unique key values. 
> If the delete statements are not executed before the insert statements, we are getting unique key violations from the database.

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