Re: [picocontainer-dev] The constant web design wall I keep hitting [long]
Konstantin Priblouda <kpriblouda-/[email protected]> Sat, 22 Nov 2008 10:52:23 -0800 (PST)
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
----[ Konstantin Pribluda http://www.pribluda.de ]---------------- JTec quality components: http://www.pribluda.de/projects/ --- On Sat, 11/22/08, Daniel Wellman <[email protected]> wrote: > From: Daniel Wellman <[email protected]> > Subject: Re: [picocontainer-dev] The constant web design wall I keep hitting [long] > To: dev-qxt/[email protected] > Date: Saturday, November 22, 2008, 4:50 PM > I'm experiencing the same issue as Mike: we used > PicoContainer 1.x and > NanoContainer to build our WebWork 2 webapp. Our DAOs > accept a > request-scope Hibernate Session object, which we've > wrapped with an > implementation that implements the Pico Startable > interface. On start() we > get the session from the HibernateSessionFactory, and on > stop() we close the > Session. We use this to implement the Open Session in View > pattern in our > webapp, since we wrap the Pico Request Listener around our > WebWork action > servlet. > > It looks like PicoContainer 2 Persistence allows both > strategies; the > documentation suggests passing a HibernateSessionFactory to > every DAO -- > HibernatePersister takes a SessionFactory parameter, and > the app registers > both ConstructableAnnotationConfiguration and > ConfigurableSessionFactory: > > http://picocontainer.org/persistence/hibernate.html > > But then how do you implement the Open Session in View with > this pattern? > Don't you need to stop the Session at the end of every > request? > > Thanks, > Dan I must disagree with this document ;) My DAOs always receive session and do not care where it came from. Hibernate configuration and session factory go into application scope, and constructable session & DAOs go into request scope. ( or even some deeper subscope defined by container chain ) regards, --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email