Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 42964 invoked from network); 9 Nov 2006 22:25:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Nov 2006 22:25:03 -0000 Received: (qmail 95558 invoked by uid 500); 9 Nov 2006 22:25:14 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 95320 invoked by uid 500); 9 Nov 2006 22:25:13 -0000 Mailing-List: contact cayenne-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cayenne-user@incubator.apache.org Delivered-To: mailing list cayenne-user@incubator.apache.org Received: (qmail 95311 invoked by uid 99); 9 Nov 2006 22:25:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2006 14:25:13 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [64.124.179.102] (HELO polatsk.objectstyle.org) (64.124.179.102) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 09 Nov 2006 14:24:59 -0800 Received: (qmail 24861 invoked from network); 9 Nov 2006 22:24:38 -0000 Received: from unknown (HELO ????????IPv6:::1?) (127.0.0.1) by localhost with SMTP; 9 Nov 2006 22:24:38 -0000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <20061108135343.14190.qmail@web54202.mail.yahoo.com> References: <20061108135343.14190.qmail@web54202.mail.yahoo.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <532F4777-3693-4829-8AB2-1B6539DACF46@objectstyle.org> Content-Transfer-Encoding: 7bit From: Andrus Adamchik Subject: Re: Nested data context problems Date: Thu, 9 Nov 2006 17:24:38 -0500 To: cayenne-user@incubator.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org I don't think I fully follow the sequence of events here, so my comments are a bit random... > 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: org.objectstyle.cayenne.access.DataRowStore@ca8f43, > modified 1 id(s) This message is only related to synching between peer DataContexts at the top level, so it is benign. > 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)) This looks suspicious. No objects should be in the "new" state after commit. Andrus On Nov 8, 2006, at 8:53 AM, Damir Bijuklic wrote: > 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: org.objectstyle.cayenne.access.DataRowStore@ca8f43, > 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: org.objectstyle.cayenne.access.DataRowStore@ca8f43, > 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