Re: Relaxed optimistic locking possible?

From: Michael Gentry (
Date: Tue Nov 25 2008 - 12:11:19 EST

  • Next message: BL: "Re: Relaxed optimistic locking possible?"

    I'm not sure if this will be helpful, but if you need to modify the
    optimistic locking stuff at run-time, without effecting other things
    using your map, then you might want to copy your DataMap:

    You can use the original with the optimistic locking set for normal
    transactions and modify the copy to be free of the locks. This code
    dates back to Cayenne 1.2, but should still be valid for Cayenne
    2.0/3.0 (change the imports from org.objectstyle.cayenne to

    On Tue, Nov 25, 2008 at 11:37 AM, Mike Kienenberger <> wrote:
    > I still think it's already possible to do what you want.
    > Please give me a concrete example of what you're trying to do, and
    > I'll help you see how to do it.
    > On Tue, Nov 25, 2008 at 5:21 AM, BL <> wrote:
    >> On Mon, 24 Nov 2008 18:23:51 -0500 "Mike Kienenberger" <> wrote:
    >>> Can't you do this already?
    >>> Each field can be set to be optimistically-locked or unlocked individually.
    >>> It might require manually changing your map entity definition in the
    >>> run-time if this behavior isn't constant, but that doesn't seem like a
    >>> big deal.
    >> Not only at runtime, it changes within the active sync process.
    >> Just to be sure: DataNodeSyncQualifierDescriptor.reset seems to call attribute.isUsedForLocking to detect attributes it has to add to the qualifier (I think you wrote this part)?.
    >> Is it possible to influence this process from outside - without knowledge of the ObjectDiff - while the query appending happens? This would be great, but I don't see it. Do you have a hint for me?
    >> BTW: What's the best practice to implement this without getting problems in the next Cayenne release?
    >> Thanks for your help.
    >>> On Fri, Nov 21, 2008 at 9:54 AM, BL <> wrote:
    >>>> the idea is to have a table related setting to request optimistic
    >>>> locking for the changed properties only. This would allow shared write
    >>>> access for clients using a distinct set of fields.
    >>>> Without global support a customized UpdateBatchQueryBuilder could
    >>>> do it probably locally, only access to the snapshot (getChangesByObjectId)
    >>>> of the current entity would be required.
    >>>> Is there any interest in such a feature?
    >> --
    >> Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL
    >> für nur 16,37 Euro/mtl.!*

    This archive was generated by hypermail 2.0.0 : Tue Nov 25 2008 - 12:12:08 EST