Hi Thiago, sorry for continuing this thread but I was wondering is it possible to somehow provide some automated ways in tapestry to reattach the session. Something like handle uncaught exceptions in normal applications. If there is such an event I guess it should be possible to somehow have this automated, no?
Cheers On Mon, Sep 2, 2013 at 10:43 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Mon, 02 Sep 2013 15:31:58 -0300, Martin Kersten < > martin.kersten...@gmail.com> wrote: > > John, if I understood you correctly you expect the session to be still >> alive when hibernate answers a action request in order to render a new >> response? If this is the case then the session is already gone. For each >> request a new session is born and closed after the rendering phase is >> completed. Do not nail me on this since I even think that for each action >> the session is also closed afterwards. But I am quite unsure. >> > > Tapestry-Hibernate and Tapestry-JPA provide the same Hibernate/JPA > Session/EntityManager for the same thread, so Martin, I'm sorry, you're not > right, it isn't one session per action, it's one session per thread, which > is the same as one session per request for Web apps. This is not related to > rendering phases at all. And this is something completely unrelated to > transaction management. > > LazyInstantionException means you're trying to lazy load some property of > an object which isn't attached to an open Session. In Tapestry, this means > "in the same request". The solution for this is to reattach the object to a > session, which is done by org.hibernate.Session.merge(), as I've already > told before. Don't forget that merge() returns an object, and that's the > one which you should use, because that's the one attached to the current > Hibernate session. > > Now this is completely unrelated to Tapestry, being completely about > Hiberante entity lifecycle, so please don't continue this thread. > > -- > Thiago H. de Paula Figueiredo > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Sincerely *Boris Horvat*