How to create atomic "save all or none" for "save" operation accrosing multiple tables.
posted 3 years ago
Hi, With spring 3.0.7 and hibernate 4, I created two EAR projects - fontend and backend.
In the font-end ear project, I implemented a cascadeAddProductAndImage function with the following implementation:
where the above three "create()" calls will save a newly created product info into 3 separate database tables.
The issue is if the last one eg. productArgicleService.create(articleList) failed, the productService.create(c) and productCategoryAssociateSerivce.create(..) still executed succesfully. This might not be a big issue as they don't violate database relational integrity. But is there any way I can use to roll back the operations if one of the create() failed?