Hi, you got me a bit confused here. See below.
Eric Schneider wrote:
Borut,
I've always stuck to the simplest approach. If I'm dealing with a
completely stateless application, I share one DataContext for all
users (in T4 as a hivemind singleton).
So each request from browser (user) can change anything in one and only
DataContext. I imagine there can be such cases where no harm can be done
to the underlying data.
For stateless apps, each individual user has their own DataContext in
the Visit object.
Isn't visit (ASO session) the very definition of stateful application?
According to HLS: "When a session-scoped application state object is
first created, or when the first persistent page property is recorded.
At this point, Tapestry will create the HttpSession to hold the object
or property.". I don't want a session to be created on my first page.
Now, I understand in T4 I can have persistent properties and stay
stateless by storing those properties on client side. I guess this can
be achieved by using hidden fields but with less comfort.
Consider this scenario:
1. Page A must collect email and serial number and answers to some
questions. Based on the email and a number a db look-up must be
made to see if this "user" already exists (if he/she already
answered the questions). This can be done by shared (singleton)
DataContext (I guess by this DataContext context =
DataContext.getThreadDataContext();)
2. If the user exists, get this User DataObject and if it doesn't
create one. In either case pass DataObject to page B via bucket
brigade pattern.
3. On page B edit some of the DataObject's properties in text fields,
validate them and consequently save them along with the data
collected on page A which were passed on page B also (user's
answers). If users existed an UPDATE must be made, if not an
INSERT. An update is made if DataObject is in CHANGED state, so
the DataContext into which this existing user was fetched in on
page A must be the same as this DataObject's properties are being
edited on page B. And that would be this global DataContext.
Can anyone comment please?
I haven't used the CayenneDataSqueezer, simply because I haven't had
to yet (though, I understand it's extremely useful).
My object entities tend to be a bit wide, so they're not something
I'd typically squeeze into a direct link for example (really long
urls can lead to undesired results w/some browsers). More often I
squeeze the object's ObjectId on actions related to specific data
objects.
Hope that helps.
Eric
On Oct 24, 2005, at 5:27 PM, Borut Bolčina wrote:
Hi,
I searched through the archives and read all that I could about
integrating Cayenne with Tapestry. The latest thread "Tapestry,
Cayenne and Squeezer" was informative, especially Filip's post which
is on wiki also. All other posts were a bit out of date I think
dealing with T3. Although reading about cayenne squeezer did light
some bulbs (ok, more of a flickering that is) I felt insecure about
how to get started.
I guess it boils down to whether you go stateless or not? In the
former case one should use ASO session scoped object (visit) and if
you want to stay stateless, than you should use all the help from
CayenneDataSqueezer. Is that correct?
Are there T4 & Cayenne (stateful, stateless or both) examples (best
practices) somewhere I missed?
Regards,
Borut
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]