• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do Not Rollback Transaction for all roll refers another

 
hunabku santos
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us how these data are put into the db, and your transaction delimiters.

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic