Hi,
I've tried 2 differents configs for managing tx in my app
The first one is fully parametered with annotations, i.e on each method
i've got :
Each time an exception is thrown (Throwable), the first exception thrownCode:@Transactional(readOnly = false,propagation= Propagation.REQUIRED)//, rollbackForClassName={"Throwable"})
is type with the exception that occured in the code. The problem with this issue is that i'm obliged to repeat thoses props on each method ( long ...)
The second way is using the AOP config (more centralized), il looks like this :
And there no annotation on the class.Code:<tx:annotation-driven transaction-manager="txManager" /> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="*" rollback-for="Throwable" /> <tx:method name="get*" read-only="true"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="serviceOperation" expression="execution(* com.company.service..*Service.*(..))"/> <aop:advisor pointcut-ref="serviceOperation" advice-ref="txAdvice" /> </aop:config>
In this 2nd way, the Exception thrown during a rollback case will be an UnexpectedRollbackException at first and MyException nested.
How to change the conf in order to have the real exception on top level ?
Thanks in advance
gz


Reply With Quote