This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Autocommit for SqlUpdate Spring object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Autocommit for SqlUpdate Spring object" Watch "Autocommit for SqlUpdate Spring object" New topic

Autocommit for SqlUpdate Spring object

Ronwaldo Cruz
Ranch Hand

Joined: Oct 17, 2006
Posts: 69

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.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Autocommit for SqlUpdate Spring object
It's not a secret anymore!