I wonder if some points of the following might make sense:
1. Instead of "isOptimisticLock" or a similar attribute the more general
attribute "lockType" could be introduced. It will allow to define the
'optimistic', 'pessimistic', or 'none' locking types in the exclusive mode
in the future.
2. Maybe, the locking should be declared on the level of obj entities as
opposite to db entities as it often becomes part of the domain logic like
the transactional behavior does and in those cases data objects should
likely be aware of it (if it is db-attribute, they won't, at least
explicitly).
3. Sometimes we want to put the locking relevant flags (timestamps, etc.) in
a separate entity and refer to it from the domain entities requiring locking
instead of defining a timestamp per database table. In this case the
corresponding ObjRelationship might be a good candidate to mark as a
participant in the locking behavior.
4. Elaborating a bit more on topic 3. one often wants to lock an update to
an entire data object subgraph based on its root, this happening when
several tables compose a single domain concept (consider something like
credit card info with its billing address (one table-entity) and its
number/exp. date/owner name (second table-entity) , when both of them must
be updated simultaniously based on a single timestamp). So it might be very
helpful to explicitly define an entity as a source of locking for several
related entities. I often use this pattern with the Cayenne data object
hierarchies (of course, I had to build an application specific locking
mechanizm, but there is room for generalization)
Andriy.
----- Original Message -----
From: "Mike Kienenberger" <mkienen..laska.net>
To: <cayenne-deve..bjectstyle.org>
Sent: Thursday, January 22, 2004 9:28 PM
Subject: Optimistic locking xml syntax
> Within the next couple of weeks, I'm going to begin working on
modifications
> to support optimistic locking.
>
> I have no idea if what I produce will be "good enough" to commit, but I'd
> like to at least write it so that it's compatible with whatever optimistic
> locking is eventually put into cayenne.
>
> To that end, can someone suggest what the likely syntax for optimistic
> locking in the xml files should be?
>
> db-attribute? obj-attribute? isOptimisticLock="true"?
>
> Or any other broad generalities that I should consider to make this as
> useful as possible?
>
> Thanks.
>
> -Mike
>
This archive was generated by hypermail 2.0.0 : Thu Jan 22 2004 - 15:56:51 EST