Hi, The process is in a separate thread, wrapped in a service, and Session is injected into the service, the process takes quite a long time, I have to restart tomcat service almost everyday.
Now, instead of injecting Session, I injected the HibernateSessionSource, then I can control the session/transaction as a normal hibernate application, it works very well. I'd say, HibernateSessionSource is a very good service. Angelo Lutz Hühnken wrote: > > Hi Angelo, > > I think the point of sticking the session to the request is to keep it > open until the request is processed, to avoid > LazyInitializationExceptions during view rendering. So you might have > to do your session management without the HibernateSessionManager. > > Then again, I wonder if it really makes much of a difference - if the > database stuff is done in the request processing thread, what do you > achieve by closing the session a tiny bit earlier than it would be by > the HibernateSessionManager anyway? > > If the database update is really so lengthy, you might want to do it > in a separate thread altogether. > > Hth, > > Lutz > > > On Wed, Mar 11, 2009 at 4:16 AM, Angelo Chen <angelochen...@yahoo.com.hk> > wrote: >> >> Hi, >> >> I need to run a lengthy thread where some database update happens, is >> there >> a way to minimize the time when a Hibernate Session is used? something >> similar to: >> >> do while not done >> >> // do some processing here >> obtain a session >> use the session >> release the session >> >> enddo >> >> If I use HibernateSessionManager, it seems there is no way to release and >> obtain a new session, any idea? >> -- >> View this message in context: >> http://www.nabble.com/T5%EF%BC%9A-getting-new-Hibernate-session-in-a-lengthy-thread-tp22448134p22448134.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > > > -- > altocon GmbH > http://www.altocon.de/ > Software Development, Consulting > Hamburg, Germany > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/T5%EF%BC%9A-getting-new-Hibernate-session-in-a-lengthy-thread-tp22448134p22524691.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org