Hi,
I have just started investigating Cayenne and am very impressed so
far.
I am trying to understand the caching/concurrency model between separate
DataContexts (within the same VM). I roughly understand the concept that a
DataContext provides an isolated transactional container for the retrieved
object graph but am not sure I understand how this interacts with the shared
object caching.
I put together a test script which did (roughly) the following:
- Create 2 DataContexts
- Retrieve same object into each DC
- In DC #1
change object property
- Commit DC #1
- In DC #2 change object property
(to different value)
- Commit DC #2
When I ran this it looks like the
objects are fetched into each DC separately (2 db calls) and changes in each
DC are isolated and committed to the DB individually without updating the
other DC (resulting in stale data in each DC after the other commits).
The Domain does have Shared Cache enabled and I was wondering if this is the
expected behaviour and if so how the shared caching actually works.
Using
optimistic-locking on the appropriate property I do then get an exception
thrown on the second commit (as expected)
Thanks, PaulC
This archive was generated by hypermail 2.0.0 : Tue Jun 08 2004 - 16:26:39 EDT