We use the dao pattern. any exceptions are handled by the different dao's.
We have overridden webrequestcycle to make a new hibernatesession (and
a transaction since hibernate 3 want's everything happening between
transactions)
The dao's use this session and at the end of the request any
uncommitted transaction is rolledback (just to be sure, the dao should
have caught any hibernateexceptions and rolledback already) and the
session is closed.

Maurice Marrink

2005/12/16, John Patterson <[EMAIL PROTECTED]>:
> Hi,
>
> I am using hibernate with my wicket application and was wondering how I can
> control transactions?  Usually I use a servlet filter that either commits the
> current transaction or rolls it back.
>
> Something like this:
>
> try
> {
>   chain.doFilter(req, resp);
>  // commit if needed
> }
> catch (Exception e)
> {
>  // roll back if needed
> }
> finally
> {
>  // close session if needed
> }
>
> I am using wicket HEAD and all exceptions are caught and handled in the
> RequestCycle so my catch block is never called.  Instead of using a servlet
> filter I tried subclassing WebRequestCycle to use onBeginRequest and
> onEndRequest.  But how do I catch exceptions to rollback the current
> transaction?  I was looking for some kind of onError handler.
>
> How do others handle this?
>
> Thanks,
>
> John
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to