cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: Optimistic Locking
Date Fri, 13 Sep 2013 20:52:58 GMT
Just be aware that it will affect all locking for your entire app.
You risk some other concurrent change going through without locking on
that column.   It might be an acceptable tradeoff.

I don't think it'd be very difficult to modify Cayenne to read from
the individual entity itself to determine if you should be locking if
you wanted to pursue that change.   getLockType() is only called a
couple of times in 3.0.2 -- once when creating a snapshot of values to
lock against, and once when creating the qualifiers from those
snapshots.

On Fri, Sep 13, 2013 at 4:33 PM, Markus Reich
<markus.reich@markusreich.at> wrote:
> perfect, thx!
>
>
> 2013/9/13 Mike Kienenberger <mkienenb@gmail.com>
>
>> On Fri, Sep 13, 2013 at 3:56 AM, Markus Reich
>> <markus.reich@markusreich.at> wrote:
>> > is there a possibility to disalbe optimistic locking for certain entites
>> in
>> > runtime?`
>> > e.g. the user get's info that there's a optimistic locking problem, then
>> > the user can force the commit ignoring the optimistic lock?
>>
>>
>> Looking at the source for 3.0.2, you can call
>> setDeclaredLockType(lockType) on the ObjEntity for your entity, where
>> lockType is one of the following:
>>
>> ObjEntity.LOCK_TYPE_NONE
>> ObjEntity.LOCK_TYPE_OPTIMISTIC
>>
>> This sets it for all entities of that type, however.  I don't think
>> there's a way to set it for individual entities.
>>
>
>
>
> --
> *Markus Reich*
> Moosbach 28/2
> 6392 St. Jakob i.H.
> www.markusreich.at / www.meeximum.at
> markus.reich@markusreich.at

Mime
View raw message