Problem with transaction autoproxy - help please!
Hi,
I'm trying to configure a service using autoproxy, and I'm having problem getting the transaction to work. In the following configuration, my application is not enlisting in a transaction, so the transaction won't rollback properly. I checked the book as well as online help, but I still could not figure out where are the missing pieces.
please help!
thanks
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="activeDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
<property name="url"><value>jdbc:oracle:thin:@hostname:1521:orange</value></property>
<property name="username"><value>user</value></property>
<property name="password"><value>pw</value></property>
</bean>
<bean id="activeTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="activeDataSource"/>
</property>
</bean>
<bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
<bean id="transactionAdvisor"
class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
<constructor-arg>
<ref bean="transactionInterceptor"/>
</constructor-arg>
</bean>
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="activeTransactionManager"/>
</property>
<property name="transactionAttributeSource">
<ref bean="transactionAttributeSource"/>
</property>
</bean>
<bean id="transactionAttributeSource"
class="org.springframework.transaction.interceptor.MethodMapTransactionAttributeSource">
<property name="methodMap">
<map>
<entry key="com.beans.BoxHandling.BoxHandlingServiceImpl.save*">
<value>PROPAGATION_REQUIRED</value>
</entry>
<entry key="com.beans.BoxHandling.BoxHandlingServiceImpl.get*">
<value>PROPAGATION_SUPPORTS</value>
</entry>
</map>
</property>
</bean>
<bean id="boxHandlingService"
class="com.beans.BoxHandling.BoxHandlingServiceImpl">
<property name="dataSource">
<ref bean="activeDataSource"/>
</property>
</bean>
</beans>