Hi, Yes, I think so. HibernateSessionSource is top of HibernateSessionManager.
DH ----- Original Message ----- From: "Angelo Chen" To: <users@tapestry.apache.org> Sent: Wednesday, March 11, 2009 2:08 PM Subject: Re: T5ï¼s getting new Hibernate session in a lengthy thread Hi, HibernateSessionManagerImpl uses HibernateSessionSource to create a session, if we use HibernateSessionSource service in code as suggested by you, then seems ok, right? dh ning wrote: > > Sorry, my fault. If code don't call any method of HibernateSessionManager, > it won't create a session. > > Thanks, > DH > > > ----- Original Message ----- > From: "Angelo Chen" > To: <users@tapestry.apache.org> > Sent: Wednesday, March 11, 2009 1:55 PM > Subject: Re: T5ï¼s getting new Hibernate session in a lengthy thread > > > > that will be a thread trigger by Quartz, create the session, close the > session repeat this until thread is over, i don't know any impact from > Tapestry-Hibernate. > > > dh ning wrote: >> >> I haven't tried it yet because now my application is out of >> tapestry-hibernate. >> But from source code of tapestry-hibernate, it should be doable. >> >> But I still doubt how you close the session created by >> HibernateSessionManager (thread scope). >> If you don't close it manually, the session still last fro the whole >> request process. >> If close manually, maybe 'session has closed' exception is thrown by >> tapestry-hibernate because at the end tapestry would try to close the >> session of HibernateSessionManager, but it has been closed manually. >> >> Thanks, >> DH >> >> >> ----- Original Message ----- >> From: "Angelo Chen" To: <users@tapestry.apache.org> >> Sent: Wednesday, March 11, 2009 1:17 PM >> Subject: Re: T5ï¼s getting new Hibernate session in a lengthy thread >> >> >> >> Hi DH, >> >> That sounds doable, we will inject the HibernateSessionSource then call >> create() to obtain the session? >> >> Angelo >> >> >> dh ning wrote: >>> >>> Maybe you can directly use HibernateSessionSource service instead of >>> HibernateSessionManager. >>> HibernateSessionSource.create() creates a new session always, and do >>> remember to commit and close the session by yourself. >>> >>> Thanks, >>> DH >>> >>> >>> ----- Original Message ----- >>> From: "Angelo Chen" <angelochen...@yahoo.com.hk> >>> To: <users@tapestry.apache.org> >>> Sent: Wednesday, March 11, 2009 11:16 AM >>> Subject: T5ï¼s getting new Hibernate session in a lengthy thread >>> >>> >>>> >>>> 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 >>>> >>>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/T5%EF%BC%9A-getting-new-Hibernate-session-in-a-lengthy-thread-tp22448134p22448992.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 >> >> >> > > -- > View this message in context: > http://www.nabble.com/T5%EF%BC%9A-getting-new-Hibernate-session-in-a-lengthy-thread-tp22448134p22449240.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 > > > -- View this message in context: http://www.nabble.com/T5%EF%BC%9A-getting-new-Hibernate-session-in-a-lengthy-thread-tp22448134p22449328.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