> From: Jeremy Quinn 

> 
> On Thursday, July 10, 2003, at 09:04 AM, Reinhard Pötz wrote:
> 
> >
> > IMO no. I would use Object/Relational mapping tools like OJB 
> > http://db.apache.org/ojb/ or Hibernate 
> > (http://hibernate.bluemars.net).
> >
> >
> >> Is there a wiki somewhere on this type of thing?
> >
> > http://wiki.cocoondev.org/
> > Wiki.jsp?page=XMLFormJXFormHibernateAndFlowscr
> > ipt
> > and here you find a component providing a Hibernate session:
> > http://cvs.werken.com/viewcvs.cgi/plexus-components/hibernate
> > /src/java/org/apache/plexus/hibernate/ 
> > DefaultHibernateService.java?cvsro
> > ot=plexus
> >
> 
> Forgive me if I have not entirely understood the usage 
> patterns of the  
> classes above.

IIUC this component provides a Hibernate Session. At the current
FOM implementation you have to take care that you open and close
these sessions correctly.

> 
> However, with the generous assistance of Ugo Cei, I am successfully  
> using the technique highlighted in the first sample here [1] for  
> managing Hibernate Sessions in my FlowApp.
> 
> The basic issue is that you want to avoid maintaining an open 
> Hibernate  
> Session whilst the user is interacting with a form (etc.). 
> The Session  
> should to be opened and closed during each Request (and any 
> Transient  
> Beans refreshed before re-use). The above technique uses a Servlet  
> Filter to manage this, with a static method to retrieve a Session in  
> your flowscript at the beginning of each Request that needs it.
> 
> [1] http://hibernate.bluemars.net/43.html
> 

Sounds cool and I remember that I've already heard from it but
haven't found the time to try it myself.


<dream-mode>
 I would like to use this Avalon component mentioned above and
 the Flow interpreter takes care of releasing (and providing)
 stateful components within my scripts. So I would have to
 lookup the Hibernate Session at the beginning(2) and until I 
 finally release(8) it I don't have to take care for it.

 1  function xxx() {
 2    var hibS = cocoon.getComponent( "hibernateSession" );
 3    var custBean = hibS.blablabla // get your beans with hibernate
 4    sendPageAndWait( "bla", {customer : custBean} );
 5    // do something (updates, reads, whatever)
 6    var someDifferentBean = hibS.blalbalba
 7    sendPageAndWait( "bla", {diff : someDifferentBean } );
 8    sendPageAndRelease( "thankYou", {} );
 9  }

 This would be IMO a very elegant way and IIU the recent discussion
 correctly possible from a technical point of view. Maybe Chris
 can comment on this :-)

 Thoughts?

</dream-mode>


Cheers,
Reinhard

Reply via email to