Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 82617 invoked from network); 10 Jun 2004 17:22:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Jun 2004 17:22:58 -0000 Received: (qmail 54895 invoked by uid 500); 10 Jun 2004 17:22:58 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 54877 invoked by uid 500); 10 Jun 2004 17:22:58 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 54863 invoked by uid 99); 10 Jun 2004 17:22:58 -0000 Received: from [66.111.4.26] (HELO out2.smtp.messagingengine.com) (66.111.4.26) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 10 Jun 2004 10:22:57 -0700 X-Sasl-enc: KdunNlB1AllfuI1PvRGXLA 1086888158 Received: from upaya.co.uk (unknown [213.48.13.39]) by www.fastmail.fm (Postfix) with ESMTP id 0263BC063F3 for ; Thu, 10 Jun 2004 13:22:37 -0400 (EDT) Message-ID: <40C8980D.4070802@upaya.co.uk> Date: Thu, 10 Jun 2004 18:19:09 +0100 From: Upayavira User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en, de, ar-kw MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Flow + Hibernate and lazy initialization References: <001501c44f0a$77277b80$3c00a8c0@alligacom.com> In-Reply-To: <001501c44f0a$77277b80$3c00a8c0@alligacom.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Nicolas Bielza wrote: >I tried to use the catch(return) trick but it doesn't seem to work. (I'm >using cocoon 2.1.4) > > Never used it, but - doesn't the cocoon.sendPage("url", {"foo":foo}, function(){hibernateSession.close();}); syntax do this? Upayavira >I added some log messages in the flowscript and it seems that the >catch(return) is not executed when I call sendPage() (the script >debugger also exposed this, and after a while, I started to see some >warnings about unclosed sessions...). > >I tried with sendPageAndWait() and this time the catch(return) got >executed, but it was called before the pipeline completed: I still had >lazy initialization exceptions during pipeline processing. > >I also tried to close the session in the postpipeline code (when using >sendPageAndWait()) and again, the session was closed before pipeline >completed. > >Here's an example flowscript (I'm not closing the session here, just >logging) : > >try { > > // ... > > var list = query.list(); > cocoon.log.error("I'm about to call cocoon.sendPageAndWait()"); > cocoon.sendPageAndWait("report.vm", {"list" : new HashSet(list)}, >function() { cocoon.log.error("I'm in postpipeline code"); }, 0); > catch(return) { > cocoon.log.error("I'm inside catch(return)"); > } >} >finally { > cocoon.log.error("I'm inside finally block"); > //clean up > cocoon.releaseComponent(hibernateFactory); >} > > >Now, here's the console output: > >Hibernate: select introspecd0_.id as id, introspecd0_.envelop as >envelop, introspecd0_.reference as reference, >introspecd0_.tradingPartner as tradingP4_, introspecd0_.docType as >docType from Introspec_Document introspecd0_ inner join >Introspec_History statushist1_ on introspecd0_.id=statushist1_.docId >Hibernate: select introspecd0_.id as id0_, introspecd0_.name as name0_ >from Introspec_DocType introspecd0_ where introspecd0_.id=? >ERROR 2004-06-10 12:14:29.561 [flow ] (): I'm about to call >cocoon.sendPageAndWait() >ERROR 2004-06-10 12:14:29.632 [flow ] (): I'm in postpipeline code >ERROR 2004-06-10 12:14:29.632 [flow ] (): I'm inside catch(return) >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select introspecs0_.id as id0_, introspecs0_.code as code0_ >from Introspec_Status introspecs0_ where introspecs0_.id=? >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc >Hibernate: select statushist0_.status as status__, statushist0_.date as >date__, statushist0_.docId as docId__ from Introspec_History >statushist0_ where statushist0_.docId=? order by statushist0_.date desc > >You can clearly see the hibernate request being executed after passing >through both postpipeline and catch(return) blocks. > >Looking back at >http://wiki.cocoondev.org/Wiki.jsp?page=RhinoWithContinuations, it seems >obvious that catch(return) is only used with continuation objects so >it's ignored when calling sendPage(). > >But I think this is quite ambiguous: > > > >>If you want to execute Flowscript code after calling the view layer but >> >> >before control > > >>leaves the interpreter, catch(return) will help >> >> > >If "after calling the view layer" means "just after calling the view >layer, but before it's completed", I can't see any use for this feature. > >So far, it looks like there's no way to know when the view pipeline is >completed, maybe this is to avoid problems if the view "re-entered" the >flow (just guessing) ? > >Finally, I'd like to know if anyone can confirm what I'm reporting (I'm >running in a minimal cocoon environment and it's not impossible that I >removed some needed components...) ? > >Thanks, > >Nicolas. > > >-----Original Message----- >From: Leszek Gawron [mailto:lgawron@mobilebox.pl] >Sent: 10 juin, 2004 05:37 >To: users@cocoon.apache.org >Subject: Re: Flow + Hibernate and lazy initialization > > >Leszek Gawron wrote: > > >>>Well, I cannot see why the releasing cannot be done in the Javascript >>>statement following the sendPage... assuming the behaviour you >>>observed was not just a bug in the Flowscript component, of course. >>> >>> >>If this is as you say you should raise this problem at cocoon-dev. I >>also wanted to loose Open Session In View pattern in favor of some >>hibernate avalon component, but that looks impossible now. >> >> >See this[1], and this[2] and this[3] and this[4] > >[1] http://marc.theaimsgroup.com/?t=108681937800001&r=1&w=2&n=2 >[2] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105825181219265&w=2 >[3] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105825410721036&w=2 >[4] http://wiki.cocoondev.org/Wiki.jsp?page=RhinoWithContinuations > LG > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org >For additional commands, e-mail: users-help@cocoon.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org >For additional commands, e-mail: users-help@cocoon.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org