0

I have a program that uses handler, businessObject and DAO for program execution. Control starts from handler to businessObject and finally to DAO for Database operations.

For example my program does 3 operations: insertEmployee(), updateEmployee() and deleteEmployee() every method being called one after the other from handler. once insertEmployee() called control get back to handler then it calls updateEmployee() again control back to handler then it calls deleteEmployee().

Problem Statement: If my first two methods in dao are successful and control is back to handler and next method it request to dao is deleteEmployee(). Meanwhile it faces some kind of exception in deleteEmployee(). It should be able to rollback the earlier insertEmployee() and updateEmployee() operation also. It should not rollback only deleteEmployee(). It should behave as this program never ran in system.

Can any one point me how to achieve this in spring jdbcTemplate Transaction management.

4

1 回答 1

0

您应该检查事务传播,特别是:PROPAGATION_REQUIRED.

更多信息: http ://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html#tx-propagation

于 2015-07-22T06:49:20.503 回答