On 3/10/08, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 10, 2008 at 7:39 PM, James Carman
>  <[EMAIL PROTECTED]> wrote:
>  > If I'm developing a Hibernate-based application and I want to install
>  >  some global StateObjectStateException handling code, what's the best
>  >  way to do it?  I could override Application.newRequestCycle()
>  >  providing my own request cycle implementation which overrides the
>  >  onRuntimeException() method.  Is there a way to plug in logic which
>  >  says "if you see exception type X, use this handler"?
>
>
> notice requestcycle.onruntimeexception() has access to the exception,
>  and returns a page, so
>
>  myrc.onruntimexception(runtimeexception e) {
>   if (e.getrootcause() instanceof hibernateexception) {
>       return new hibernateerrorpage(e);
>   }
>  }

Okay, so this is the way to handle it, eh?  I just wanted to make sure
there was nothing out there already for this.  I may make up a
Spring-based solution that allows me to "register" an exception
handler for specific types of runtime exceptions.  That way, my forms
don't need to know I'm using Hibernate.  They can just deal with my
domain interface (a repository).  Thanks for the tip!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to