As much as I'd like to recommend session-per-conversation -- If your problem is with hibernate entities sticking to pages in the pool it won't really help you, because your page-instances will be re-used by random users. So you *must* properly clean them up after render, either manually or, recommended, by using tapestry-managed properties (abstract getters).
hth, Marcus > -----Original Message----- > From: Jean-Francois Poilpret [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 18, 2006 4:29 PM > To: [email protected] > Subject: RE: Hivetranse: BUG or incorrect usage of DeferSessionClose? > > Hello Aleksej, > > Since I am not a Tapestry user, please take my answer with > great care;-) As far as I understand the problem you > describe, it seems that Tapestry, on refresh, uses a cached > page, I believe that your page stores your persistent object > (loaded on first page display). The -potential- problem in > this case is that the object is not attached to any Hibernate > session any more. > > Maybe what you are looking for is the "long conversation" > pattern of Hibernate. However, HiveTranse does not (yet) > implement this pattern (and will not do in the short run > because I am more than busy currently). > > You have 2 possible solutions (out of the scope of HiveTranse > but more in the scope of usage patterns of Hibernate): > 1/ Use another framework for Hibernate integration in > HiveMind/Tapestry (I know there is at least one such > framework that supports "long conversation" > pattern, I'll let the "parents" of these frameworks > complement my answer). > 2/ Go on with HiveTranse, but make sure your persistent > object, as stored in your page, is reattached to a new > Hibernate session (see Hibernate API) that will be again > provided by HiveTranse. > > Hope this will give you some useful hints. > > Cheers > > Jean-Francois > > -----Original Message----- > From: Aleksej [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 18, 2006 4:31 PM > To: [email protected] > Subject: Hivetranse: BUG or incorrect usage of DeferSessionClose? > > In my application I need to allow Lazy initialization. > I am using hibernate3 and Hivetranse. > Property 'hivetranse.hibernate3.DeferSessionClose' is set to 'true'. > When I first time viewing page where lazy access to object > property is used everything works fine. ( With > DeferSessionClose turned to false I got LazyInitializationException ). > But if I refresh this page then I got > LazyInitializationException too. > Later I found that if I will > prevent Tapestry to create another one instance of the page > in the pool ( making lots of request at one time ) then that > new page will be viewed OK. It looks like a BUG but I am not sure. > >
