Hmm, I don't think it would work for me then. When they login (and
their rights are stored in the session), there is a database selection
page (test, acceptance, production, etc). When they choose a database,
I create the DC and store it in the session then and from that point on,
they are tied to that DB, unless they go back to the start page and
choose a different DB, and then it all gets swapped out. So, in my
case, each session can access all the DDs, just one at a time. Maybe I
just went with the "simpler" WebObjects-like approach ...
/dev/mrg
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Wednesday, April 05, 2006 10:22 AM
To: cayenne-use..ncubator.apache.org
Subject: Re: accessing cayenne sessions
The ThreadLocal approach will work, however you will need to
customize the configuration objects to fit your needs.
For instance if the DataDomain is assigned to the session on creation
(i.e. each session can only access a single DD), you can subclass
WebApplicationContextFilter, overriding 'doFilter' to pick a specific
domain for your session DataContext.
Andrus
On Apr 5, 2006, at 6:10 PM, Gentry, Michael ((Contractor)) wrote:
> Andrus, would this work for more complex data models? I have 6
> DataDomains in mine. :-)
>
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
> Sent: Wednesday, April 05, 2006 4:00 AM
> To: cayenne-use..ncubator.apache.org
> Subject: Re: accessing cayenne sessions
>
>
>
> On Apr 5, 2006, at 2:36 AM, Cypher her wrote:
>
>> public class MyBasePage extends BasePage
>> {
>>
>> public DataContext getDataContext()
>> {
>> return DataContext.getThreadDataContext();
>> }
>> }
>>
>> and all of my pages should subclass MyBasePage. And I am assuming
>> Tapestry and the servlet container will take care of making sure
>> the Session is consistent throughout the workflow i.e. each user
>> gets a unique DataContext and they maintain the same DataContext
>> from page to page until the session times out..
>
> Yep, HttpSession is a servlet container feature. It just works.
>
> Andrus
>
>
This archive was generated by hypermail 2.0.0 : Wed Apr 05 2006 - 10:30:43 EDT