aspose file tools
The moose likes Object Relational Mapping and the fly likes How to create atomic Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "How to create atomic "save all or none" for "save" operation accrosing multiple tables." Watch "How to create atomic "save all or none" for "save" operation accrosing multiple tables." New topic
Author

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

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 204
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.
Sam
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to create atomic "save all or none" for "save" operation accrosing multiple tables.
 
Similar Threads
Mock Exam Q - confusing?
Jsp and javabean
File reloading problem
Java EE5 Tutorial - 'ant create-tables' BUILD FAILED
Creating Tables Automatically with Hibernate and JPA