Hi, Note that in my 'improvement', the Hibernate session is created on demand, just as in your solution. The filter servlet and the servletRequest attribute is just a trick to delay the commit/rollback and to simplify the business logic (i.e. less code needed for tx handling).
-----Original Message----- From: Eric Everman To: Neil Clayton; Norrman Per; [EMAIL PROTECTED] Sent: 2003-01-17 00:02 Subject: Re: [Tapestry-developer] Tapestry and O/R persitence services I'm willing to help. My original implementation is not very sophisticated and it sounds like Norman has made several improvements on it. I have since switched over to using a hibernate.cfg.xml file to do the configuration, which eliminates the need to have config info in the web.xml file and in a hibernate.properties file. One question for Norman (and others): Is there a way to create a Session with request-level scope without the use a ServletFilter? I would like to avoid configuration outside the Tapestry API. All of the events that I am aware of seem to be page-level scope. Could we perhaps subclass the Engine or are there beginRequest/endRequest methods that I am unaware of? Eric Everman At 1/16/2003, Neil Clayton wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > > >I think this would be cool to add into some 'OR contrib' package. Seems to me >like a number of people have posted messages here talking about this, and to >have at least some skeleton solutions available would be good. > >Anyone else on the same boat? > >Neil > >On Thursday 16 Jan 2003 3:51 pm, Norrman Per wrote: > > Hi, > > > > Thank you for the code. I used parts of your solution and combined it with > > a ServletFilter that do the commit/rollback stuff. I made SessionWrapper a > > public > > class and also included a boolean success flag; the SessionWrapper is also > > stored > > in the ServletRequest. When a Hibernate exception occurs, the > > SessionWrapper#success > > field is set to false, and an ApplicationRuntimeException is thrown. The > > servlet filter > > post processing either commit or rollback depending on the success flag. > > > > In effect, I now have transactions of single request scope for one or more > > pages. The code is not quite ready yet, but if anyone is interested .... > > > > > > /Per Norrman > > > > > -----Original Message----- > > > From: Eric Everman [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, January 10, 2003 5:10 PM > > > To: [EMAIL PROTECTED] > > > Subject: [Tapestry-developer] Tapestry and O/R persitence services > > > > > > > > > Norrman- > > > > > > I wrote a Tapestry extension for Hibernate sessions, but I > > > have not tried > > > it yet in 2.3. It creates Hibernate sessions on demand with > > > a scope of a > > > single page for a single request. Sessions are automatically > > > committed > > > when the page renders or when you switch pages (cycle.setPage()). > > > > > > My source code is attached - let me know if you have any > > > problems using it > > > in 2.3. > > > > > > Eric Everman > > > > ########################################### > > > > This message has been scanned by F-Secure Anti-Virus for Microsoft > > Exchange. For more information, connect to http://www.F-Secure.com/ > > > > > > ------------------------------------------------------- > > This SF.NET email is sponsored by: Thawte.com > > Understand how to protect your customers personal information by > > implementing SSL on your Apache Web Server. Click here to get our FREE > > Thawte Apache Guide: > > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en > > _______________________________________________ > > Tapestry-developer mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/tapestry-developer > >- -- >Regards, >Neil Clayton > >(PS: If you see strange text you don't understand underneath my email, don't >worry - it's just my PGP signature) >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.0.7 (GNU/Linux) > >iD8DBQE+JymjLXcfQF3yrNoRAjAQAJ4gpeokI93+xpYylnp2AtdjTsHU2wCfRDH+ >oNthJqSgX/BaHaNCrVQfBS4= >=WHPu >-----END PGP SIGNATURE----- ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.F-Secure.com/ ------------------------------------------------------- This SF.NET email is sponsored by: Thawte.com Understand how to protect your customers personal information by implementing SSL on your Apache Web Server. Click here to get our FREE Thawte Apache Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en _______________________________________________ Tapestry-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/tapestry-developer
