You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "John Huss (Commented) (JIRA)" <ji...@apache.org> on 2011/12/06 21:57:40 UTC

[jira] [Commented] (CAY-1630) [PATCH] On OptimisticLockException, add method to return the object that caused the failure

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

John Huss commented on CAY-1630:
--------------------------------

Thanks for looking at this.  The question I still have is - is there are way to get the failed object that is guaranteed to succeed?  I would think that there has to be.  My interest in getting the object is to inspect the uncommitted state which is only available in the context that performed the commit; and the context must still have the object since it just tried to save it and failed.  So in a block like this:

try {
  context.commitChanges();
} catch (OptimisticLockException e) {
  Object o = e.getFailedObject();
}

can the failed object ever NOT be obtainable? 
                
> [PATCH] On OptimisticLockException, add method to return the object that caused the failure
> -------------------------------------------------------------------------------------------
>
>                 Key: CAY-1630
>                 URL: https://issues.apache.org/jira/browse/CAY-1630
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.1M4
>         Environment: Mac 10.6
>            Reporter: John Huss
>            Priority: Minor
>              Labels: patch
>             Fix For: 3.1M4
>
>         Attachments: optistic_lock_failed_object_patch.txt, optistic_lock_failed_object_test_patch.txt
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> This patch adds a method to OptimisticLockException that returns the object the was the cause of the locking failure. This is useful if you want to resolve the error automatically somehow. A test case is also included.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira