This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • 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??
Posts: 1682
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!