Java Reference
In-Depth Information
Listing 6-33.
transaction-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="
http://www.springframework.org/schema/aop"
xmlns:tx="
http://www.springframework.org/schema/tx"
xsi:schemaLocation="
<!-- this is the service object on which the transaction has to be applied -->
<bean name="uwrAppService"
class="com.apress.einsure.business.impl.
å
UnderwritingApplicationServiceImpl">
</bean>
<!-- the transactional advice decides what needs to be done -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- all methods starting with 'list' fetch data from db, hence read-only -->
<tx:method name="list*" read-only="true"/>
<!-- other methods use the default transaction propagation
attribute REQUIRES -->
<tx:method name="underwrite*" rollback-for="ProductRuleViolationException"/>
<tx:method name="update*" propagation="REQUIRES_NEW"
å
no-rollback-for="TruncatedFirstNameException"/>
</tx:attributes>
</tx:advice>
<!-- other beans -->
</beans>
