Hi Guys,

catch (return) {session.close ()}

has worked fine when I needed it in the past.

What confused me about it was that the 'catch' statement is not paired with a 'try' or a 'finally' statement it sits by iteslf.

HTH

regards Jeremy


On 10 Jun 2004, at 09:15, Reinhard Poetz wrote:

Leszek Gawron wrote:

One of the users had reported an example that needs resolving. As it is something that affects also me I didn't want to wait for him to post some questions.

Imagine you obtain some resources that need to be valid during view rendering. A hibernate session is a good example. You need to have it open during view generation. Otherwise you will not be able to use lazy initialized collections. The problem is that cocoon.sendPage does not wait for the view generation to be finished:

var session = obtainHibernateSession();
var bizData = getSomeBizDataUsingSession( session );
cocoon.sendPage( "view.jx", { biz: bizData } );
session.close();

This example will throw if bizData contains lazy collections because when they will be accessed session will already be closed. AFAIU there is no way to call any piece of code when you are sure that view rendering has finished. This is a very common case I think so this should be solved somehow.
LG


maybe this (http://wiki.cocoondev.org/Wiki.jsp?page=RhinoWithContinuations) helps - see the part containing catch(return)

--
Reinhard


--------------------------------------------------------

                  If email from this address is not signed
                                IT IS NOT FROM ME

                        Always check the label, folks !!!!!
--------------------------------------------------------


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to