> On 22-Oct-07, at 6:50 AM, Angelo Chen wrote: > > > > Thanks for the link, but what's the conclusion? Tapestry-hibernate > > has to be updated to close the session? there seems no decision in > > that thread.
That is _my_ conclusion :). You're right, that thread didn't really go anywhere, partly because i dropped the ball and didn't go on to post this as an issue on jira. I've now done so: https://issues.apache.org/jira/browse/TAPESTRY-1850 > > ... if I understand correctly: onActivate the session was opened > > because a object is retrieved, then automatically close. onSuccess > > another session was opened because of call to update/merge, am I right > > here? No, i don't think so. Both onActivate() and onSuccess() are called within the same thread, so will actually use the same Session instance. Immediately after this though, you will see a new Session being opened because tapestry doesn't just render the result in the same thread - it sends a redirect back to the browser, which will in turn activate your page again. So: 1. user navigates to page, -> onActivate fires, Session 1 is opened. 2. user submits form, -> onActivate, binding, validation, onSuccess all occur in Session 2. 3. onSuccess returns null, -> tapestry sends a redirect to the browser, -> browser asks for the page, -> onActivates fires again, Session 3 is opened. There are of course other events that will fire, i'm highlighting the ones from your example. > > I use now merge which get rid of the problem so far. This will probably work, but i would consider it a workaround. The real problem, IMO, is that a previous session hasn't been closed (by the framework). The merge method is designed to be used, as i understand it, in a much less typical scenario - when the object in your current session needs to be updated with changes made to a copy of it in a different session (or out of session). Ok, thats probably not clear (!), but the point i'm trying to make is you're having to use a fairly specialized method in hibernate for just a run-of-the-mill scenario. If you're convinced by this, patching HibernateSessionManagerImpl.java as described in the other thread is trivial to do. Hopefully the issue will be fixed and you'll only have to do this temporarily. Of course you may just stick with merge() in the meantime - i just wanted to give you my understanding of the problem. Cheers, lasitha. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]