You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by John Huss <jo...@gmail.com> on 2011/10/07 16:58:05 UTC

Getting failed object on OptimisticLockException for deleted objects

I see that I can call OptimisticLockException.getFreshSnapshot to get
information about the object that failed to save, but if the object was
deleted in the DB, then this returns null.  In that case, how do I find out
which object was the reason for the failure?

Thanks,
John

Re: Getting failed object on OptimisticLockException for deleted objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
Quite possibly you are right :-) 

Personally not using optimistic locking that much myself, and didn't have time to dig the relevant code...

Andrus

On Oct 10, 2011, at 7:22 PM, John Huss wrote:

> So based on the silence I'm going to assume that this functionality doesn't
> currently exist and I'll see if I can work up a patch.
> 
> John
> 
> On Fri, Oct 7, 2011 at 10:03 AM, John Huss <jo...@gmail.com> wrote:
> 
>> 
>> I see that I can call OptimisticLockException.getFreshSnapshot to get
>>> information about the object that failed to save, but if the object was
>>> deleted in the DB, then this returns null.  In that case, how do I find out
>>> which object was the reason for the failure?
>>> 
>> 
>> I'm also not sure how to get the failed object when it's not deleted - I
>> can't convert the fresh snapshot to a PersistentObject without knowing what
>> class / entity it is.
>> 


Re: Getting failed object on OptimisticLockException for deleted objects

Posted by John Huss <jo...@gmail.com>.
So based on the silence I'm going to assume that this functionality doesn't
currently exist and I'll see if I can work up a patch.

John

On Fri, Oct 7, 2011 at 10:03 AM, John Huss <jo...@gmail.com> wrote:

>
> I see that I can call OptimisticLockException.getFreshSnapshot to get
>> information about the object that failed to save, but if the object was
>> deleted in the DB, then this returns null.  In that case, how do I find out
>> which object was the reason for the failure?
>>
>
> I'm also not sure how to get the failed object when it's not deleted - I
> can't convert the fresh snapshot to a PersistentObject without knowing what
> class / entity it is.
>

Re: Getting failed object on OptimisticLockException for deleted objects

Posted by John Huss <jo...@gmail.com>.
> I see that I can call OptimisticLockException.getFreshSnapshot to get
> information about the object that failed to save, but if the object was
> deleted in the DB, then this returns null.  In that case, how do I find out
> which object was the reason for the failure?
>

I'm also not sure how to get the failed object when it's not deleted - I
can't convert the fresh snapshot to a PersistentObject without knowing what
class / entity it is.