Hi,
I am finding difficulties when i set my operation in declarative transaction.
the rollback is not happening even though the perticular method gives exception .can anybody help me to solve this?
my code look as below
my dao class where i get exception
-----------------------------------
public String myQuery()throws DataAccessException {
String name = "";
try {
jt = new JdbcTemplate();
jt.setDataSource(dataSource);
name =(String) jt.queryForObject(
"select name from retiredb where Id=1",
java.lang.String.class);
jt.update("update retiredb set name='test20' where Id=1");
jt.update("insert into spring2 values ('test2','address2')");
} catch (Exception ee) {
System.out.println("inside exception Exception ------" + ee);
}
return name;
}
my xml files
-----------------
<bean id="retirementBusinessObject" class="beans.RetirementBusinessObject">
<property name="dataAccessObject"><ref local="testSpring"/></property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
<property name="dataSource"><ref local="dataSource"/></property>
</bean>
<bean id="senderNewTx" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="target">
<ref bean="retirementBusinessObject"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
is there any problem in my aproach?
or any additional coding i have to do for the rollback?
Thanks
biju


Reply With Quote