cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musall, Maik" <m...@selbstdenker.ag>
Subject A way to refreshObject()
Date Tue, 21 Feb 2017 20:54:18 GMT
Hi all,

I have an application using a big shared snapshot cache. Objects freshly instantiated in an
ObjectContext get their attributes populated based on the snapshot cache at the time, and
keep them during the context's lifetime, which is also what I want. (Last week I found a page
on cayenne.apache.org <http://cayenne.apache.org/> explaining this behaviour, but I
can't find it again. Seems not to live within the linked Guide hierarchy.)

In some cases though, I have object instances in ObjectContext 1 which I know are getting
modified in ObjectContext 2, and I want them to be updated after commit in context 1. In EOF,
I could call oc1.refreshObject(obj), or even oc1.refreshAllObjects(), which will merge the
new values in from the snapshot cache. Is there any way to do this in Cayenne, short of refetching
which would cost a roundtrip to the database even though I know I already have the current
values in the snapshot cache?

(I had a question posted recently about "creating a fault for an ObjectId", but this is different
because I need the commit in context 2 to go through to the database.)

Maik


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message