• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Do Not Rollback Transaction for all roll refers another

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Show us how these data are put into the db, and your transaction delimiters.

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic