I have following code in Spring –
<tx:advice id="transactionAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="org.springframework.dao.DataAccessException" no-rollback-for="java.lang.IndexOutOfBoundsException"
timeout="30" />
</tx:attributes>
</tx:advice>
This configuration will rollback for DataAccessException and all its sub-exceptions. i.e. the exception hierarchy is rolled back. However I want to be able to rollback a set of exceptions (not belonging to same hierarchy). Is it possible to write something like –
<tx:advice id="transactionAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="org.springframework.*" no-rollback-for="java.lang.*"
timeout="30" />
</tx:attributes>
</tx:advice>
I have tried the above code but it does not work.
No, you can’t use wildcards, but
will do that you want. Match is positive if the
Exceptionclass name contains the pattern.