Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Autocommit for SqlUpdate Spring object

Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I've been experiencing a transaction management issue with Spring's SqlUpdate class.

I have 3 instances of SqlUpdate, two of them are update statements the other is an alter table statement. I have a catch statement wherein if there's an error transaction should be rolled back.

This works ok if the problem is with the update statement, say update statement 1 is ok, update statement2 gets an error statement1 gets rolled back. But if the problem is with the alter table statement, the 2 update statements get committed even though rollback is called.

If anybody has an idea, it would be greatly appreciated. Thanks.
Posts: 17344
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, it is not a transaction problem. It is that an Alter Table command is a DDL command, and Updates are CRUD commands. Databases act differently with different types of commands. In almost all databases a DDL script means a commit is run automatically by the database. No ways around that except maybe in some kind of database configuration. But you would need to contact your DBA to do that.

Can you shoot lasers out of your eyes? Don't look at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!