[jboss-user] [JBoss AOP] - hanling exception ignored

bonerandi do-not-reply at jboss.com
Fri Feb 13 04:00:44 EST 2009


Hi
I would like to test the management of Hibernate errors  in my application.

I encoded an aspect :

public class SQLDeadlockExceptionInjector
  | {
  | 	/**
  | 	 *
  | 	 * @param invocation
  | 	 * @return
  | 	 * @throws Throwable
  | 	 */
  |    public Object throwDeadlock(Invocation invocation) throws Throwable
  |    {
  | 	   throw new HibernateException("",new SQLException("Oracle Deadlock", "12345", 23000));
  |    }
  | }

My jboss-app.xml

<aop>
  | 
  | 	<aspect class=" SQLDeadlockExceptionInjector" scope="PER_INSTANCE"/>
  | 		 <bind pointcut="call(* $instanceof{net.sf.hibernate.Session}->saveOrUpdate(..) throws net.sf.hibernate.HibernateException)">
  | 			<advice name="throwJDBCException" aspect=" SQLDeadlockExceptionInjector"/>
  | 		</bind>
  | 
  | 
  | </aop>


This aspect handling exception in application but it was nener catch by the handler 

try{
  | 
  |  session.saveOrUpdate(Object)
  | 
  | } catch (HibernateException ex) {
  | 
  | .........
  | particular treatment
  | .........
  | 
  | }

why error is never  handling by the catch ?

how to test the correct treatment  of error with aop ?

thanks a lot







View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209802#4209802

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4209802



More information about the jboss-user mailing list