• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Is using Transaction management mandatory while performing operations with db in Spring Hibernate?

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I went through Spring transaction management. I have a very simple question assume in a banking application with Spring Hibernate Integration
is it mandatory to use @Transactional on credit & debit methods. If I don't want a rollback still do I have to put the methods in a transaction scope??
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I sure would hope you would want to roll back for that You can set the rollback strategy on the @Transactional annotation, so if you do not want a rollback to it there.



Database operations require transactions. Even if you do not create one the database will create one around that single operation. When this is the case with writes people use autocommit= true. I do not recommend this. I would always use a transaction in your spring code on any operation that writes to the database.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic