• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create atomic "save all or none" for "save" operation accrosing multiple tables.  RSS feed

sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Any suggestion is very will appreciated.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!