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.

You can debug (IDE) Tapestry any time and set a breakpoints on
SessionImpl.close methods (Hibernate) or even add an interceptor to the
session close event. See the hibernate documentation on that issue. Also
you can go to the HibernateManagerImpl and add breakpoints for the session
accessing, transaction methods (CommitAfterAdviseImpl) etc. There you can
see in the debugger what is really happening. Or you check the logging
behavior and add additional logging information etc. Also you can add
Watcher to the debugger so the debugger watches for the current session the
hibernate manager provides (including SessionImpl properties and methods
regarding to the close behavior) etc.

Also remember the session is driven by transactions (@CommitAfter). So
whenever you are leaving the context of a transaction you should see all
the entity information as being invalid and potentially stale. There are
some cave eats at the transactional issues regarding to first and second
level cache of hibernate.

Additional informations
http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/transactions.html
http://stackoverflow.com/questions/337072/what-is-first-and-second-level-caching-in-hibernate



2013/9/2 Thiago H de Paula Figueiredo <thiag...@gmail.com>

> See org.hibernate.Session.merge(). And this isn't really about Tapestry.
>
>
> On Mon, 02 Sep 2013 13:10:13 -0300, Jon Williams <
> williams.jonat...@gmail.com> wrote:
>
>  quoting from the wiki...
>>
>> https://wiki.apache.org/**tapestry/**Tapestry5AvoidingLazyInitializ**
>> ationExceptions<https://wiki.apache.org/tapestry/Tapestry5AvoidingLazyInitializationExceptions>
>> "*To really solve Lazy Initialization Exceptions, you need to find out why
>> the Hibernate session closed before you wanted it to, and/or you need to
>> get a new session reattach the object."*
>> *
>> *
>> *
>> *
>> *
>> *
>> *
>> *
>> *Hi Tapestry Users*,
>> The above quote may be good advice on the wiki? However the wiki entry is
>> lacking example code to show how to practically apply the good advice.
>>
>> So...
>> Can anyone answer my following query about the methodology proposed on the
>> tapestry wiki page?
>>
>> Is there any sample/example code u know of that where upon finding the
>> hibernate session is closed, it creates a new hibernate session and then
>> somehow reattaches it to the apps
>> org.apache.tapestry5.**hibernate.**HibernateSessionManager?
>>
>> I need to drill in to a (Entity tree node w/ lazy fetch Children Entity
>> nodes) tree model and recursively perform some behavior on each node in an
>> entire sub tree for any given tree node.
>>
>> Right now I'm stuck behind a LazyInitialization Exception because the
>> hibernate session is closed
>> when I attempt to access a child nodes' children in my UI's actionlink
>> handler method.
>>
>>
>> TIA
>> Jon
>>
>>
>>
>>
>>
>> *
>> *
>>
>
>
> --
> 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
>
>

Reply via email to