Hi,
I did changes as per the instruction but still i couldnt
do transaction rollback using declarative transaction.
My code is given below
TestSpringDao.java my dao class where i get the exception
--------------------------------------------------------------------
public String myQuery()throws DataAccessException {
String name = "";
try {
jt = new JdbcTemplate();
jt.setDataSource(dataSource);
jt.update("update retiredb set name='test12' where Id=1");
jt.update("insert into spring2 values ('test2','address2')");
}
catch (DataAccessException e)
{
System.out.println("inside exception DataAccessException ------" + e);
throw e;
}
catch (Exception ee) {
System.out.println("inside exception Exception ------" + ee);
}
return name;
my buisiness class from where i am calling the daos perticular method
-------------------------------------------------------------------------------
public boolean CreateRetirementDataObject(RetirementPlanBean rpb) {
try {
ts.myQuery();
}
catch (DataAccessException e)
{
System.out.println("inside DataAccessException buisiness class ------" + e);
}
catch (Exception e) {
System.out.println("inside exception in buisiness class<<<<<"+e);
}
return true;
}
and my xml files are look like this
----------------------------------------
<bean id="testSpring" class="beans.TestSpring">
<property name="dataSource"><ref local="dataSource"/></property>
</bean>
<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 bean="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,-DataAccessException</prop>
</props>
</property>
</bean>
how can i overcome the problem?
is there any mistakes using the transaction setting done by me?
Thanking you,
Biju


Reply With Quote