Hi,
I'm playing around with nested data context's and tapestry.
Using tapestry 4.1.1 and cayenne 1.2.1.
I have encountered an issue with cayenne that i don't quite understand. I will
describe my setup and what I'm trying to do.
I'm trying to use nested data context's on subforms/subpages.
This way i can discard changes inside subforms although my dataobject that is
rendered on the form is updated (i either call commitChangesToParent on nested
data context, or i don't).
I'm also using tapestry data squeezer, which is mechanism in tapestry for
converting from data object to string and vice versa.
DataSqueezer has two methods that look similar to this: String squeeze(Object)
and Object unsqueeze(String) .
In testing i have encountered an issue which i have tried to reproduce with
test case, but have not been able to do so, so far.
When i navigate between three pages, each having it's own datacontext, where
top page uses session bound datacontext and subpages use ones derived with
createChildDataContext (so third page has datacontext that derives from derived
datacontext from second page).
1. I go to the third page,change some data and commit it
2. I commit it on the second page also
3. I commit it on the first page, so it goes to the database - here i can see
sql updates but also indication of event i think is used for cache
synchronisation
DataRowStore [DEBUG] postSnapshotsChangeEvent: [SnapshotEvent] source: [EMAIL
PROTECTED], modified 1 id(s)
4. I go to the second page and it gets rendered with current (modified) version
of dataobjects
- when i debug converting of dataobjects to strings i notice that my
dataobject is in the same, new, state as i would expect, i get the expected
data with
DataObjectUtils.objectForPK(object.getDataContext(), "Object",
DataObjectUtils.pkForObject(object))
- it gets converted to something like "Object:200" where Object is entity
name and 200 is PK
5. during the next request i try to parse string back into the object, here the
funny stuff happens:
- i parse "Object:200" and use DataObjectUtils.objectForPk(dataContext,
"Object", 200) to fetch the object
- i have checked few times that the datacontext i use here is the same as
one above
- the object i receive is NOT the one i have just rendered to the string,
it has it's properties changed to what they were before step 1
- during this step i notice message in tho log
DataRowStore [DEBUG] postSnapshotsChangeEvent: [SnapshotEvent] source: [EMAIL
PROTECTED], modified 1 id(s)
- tracing objectForPK shows that it reads the old values from the cache
though they should not be there and it seems they weret there a few moments
ago??
I'm using shared cache, single jvm. What else could be wrong. If i restart the
app to reload the caches it's all ok. Also i would like to load this object
from the cache because it should have correct values in it.
Any ideas what I'm missing? Any further info i could post?
Damir
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease
of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html