aspose file tools*
The moose likes Spring and the fly likes Do Not Rollback Transaction for all roll refers another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Do Not Rollback Transaction for all roll refers another" Watch "Do Not Rollback Transaction for all roll refers another" New topic
Author

Do Not Rollback Transaction for all roll refers another

hunabku santos
Greenhorn

Joined: Feb 06, 2013
Posts: 1
Hi

I trying including a family of people, one by one... and the son records referencing the children their parents.

I have one @Transactional(propagation= Propagation.REQUIRED, rollbackFor = Throwable.class)

customer Table:
ID_CUSTOMER | NAME_CUSTOMER | ID_FATHER_CUSTOMER
    1 | BOB | (null)
    2 | BOB SON | 1
   3 | SANDY SON | 1

...

In this case, let's imagine that 'SANDY SON' has inconsistent data and the application will get throws an exception.

I am not able to perform the rollback of the entire family (BOB and BOB SON) .... They're already commited in the database. Why ?

I can not configure Spring do not commit in this situation described above?

How I can get rollback?

Tks []'s
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 122

Show us how these data are put into the db, and your transaction delimiters.

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Also, why did you put

rollbackFor = Throwable.class

No need for that unless you want to really want to restrict what Exceptions causes a rollback and what doesn't. Which is a very rare case.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
Don't get me started about those stupid light bulbs.
 
subject: Do Not Rollback Transaction for all roll refers another