cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject Re: Hibernate sessions (was Re: [vote results] FOM)
Date Thu, 19 Jun 2003 07:20:06 GMT
Jeremy Quinn wrote:
> is that:
> var session =; ?


> Would you do something like this, if you wanted to use Transactions? :
> var transaction;
> try {
>   transaction = session.beginTransaction();
>>   session.saveOrUpdate(model);
>   transaction.commit();
> } catch (e) {
>   Persistence.rollback(transaction);
>   log.error(e.getMessage());
>   // send an error view
> }

Yes. What's important is that you must perform your transaction in the 
scope of a single HTTP request, otherwise you'll have to use another 

> Would you consider doing something like the above from inside a sendView 
> validation function, adding a violation if you had to roll back?

Haven't thought about it.

> By what I understand now ..... what I require is the Persistence class 
> from the page you sent me and a configuration to add to web.xml. What I 
> am not sure I understand is what that configuration should be.

First of all, you need a Servlet 2.3 compliant container. Recent 
versions of Jetty or Tomcat are OK. Then you need to patch Cocoon's 
web.xml file to refer to the 2.3 DTD:

   <!DOCTYPE web-app PUBLIC
         "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

Then, as first children of the <web-app> element add the following lines:

     <!-- change this to the name of your filter class -->


As far as JNDI is concerned, I've removed all JNDI code from my 
Persistence class and simplified it a little. I'm sending you privately 
the class.


Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail:

View raw message