There is in fact an on error handler Application.onRuntimeException(). its called whenever there is a runtime exception. instead of trying to do try/catch in your filter you can use a request variable to indicate success/failure. set it to success, and in the error handler set it to failure. I use this approach whenever i know my requirements will never exceed the single-transaction-per-request limitation.

Hope this helps,
-Igor



On 12/15/05, John Patterson <[EMAIL PROTECTED]> wrote:
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

Reply via email to