I am using Spring BatchSqlUpdate to write to 2 different tables. I wish that if the insert to the second table fails then the insert to the first table should also be rolledback. I tried using TransactionTemplate to achieve the same. However the same doesnt seem to work . Following is the code and my configuration.
As explained above the insert to the nos table fails since i have made it fail purposely by giving wrong column name. However still the insert to the price table is not rolled back and is commited. What do i to achieve the intended purpose.
Do you see any exception thrown when you insert data to a column that does not exist?
I am not familiar with Spring framework yet. But I guess the data is successfully committed to the price table in one transaction while the transaction for nos table fails.