I have been
interested in upgrading our project from an early 2.0 release to the latest
release (I'm testing 2.1.7).
However, I'm having
a problem with a particular chain of insert/update statements after the
upgrade. When I switch in the new version of iBatis, my transactions just
don't commit correctly. The statements all execute and go through the
motions, but it appears as if no commit actually takes place or if the
transactions are being rolled back.
I've tried looking
in several places to see if changing some config options would help me, but
nothing seems to work. Does anyone know of a good place for me to start
looking?
My statements
(working with the early 2.0 release) go like this:
try {
sqlMap.startTransaction();
}
catch (SQLException sqlEx) {
throw new DaoException("Error starting transaction for saveMovie()", sqlEx, loginData);
}
sqlMap.startTransaction();
}
catch (SQLException sqlEx) {
throw new DaoException("Error starting transaction for saveMovie()", sqlEx, loginData);
}
try {
sqlMap.insert("myMap.insertRowX", blah1);
sqlMap.insert("myMap.insertRowA", blah2);
sqlMap.insert("myMap.insertRowB", blah3);
sqlMap.insert("myMap.insertRowC", blah4);
sqlMap.update("myMap.insertRowC", blah5);
sqlMap.commitTransaction();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
sqlMap.endTransaction();
}
And they work
flawlessly. In my actual app, there are many more queries, all in this
transaction...
Leaving the database
(Sybase) the same, everything else the same, and switching to the new libraries
causes everything to run fine... No exceptions, nothing. But the data is
never updated or inserted, as if a rollback happened!! The reason I know
that it goes "through the motions" is that the queries will still die with an
exception when trying to insert a duplicate key value or when I violate some
other referential integrity settings... Also newly created identity values are
placed happily back into the objects after the inserts... Even though after the
transaction is committed, the new rows with those values can't be found in the
database!!!
I'm using JDBC for
the transaction manager, and DBCP for the connection pool.
The most similar problems in the mailing list that I can find
are problems relating to transactions not working in WebsphereAS, (which I'm not
using) and someone mentioning that their commands are rolling back every
statement causing trouble with MS Sql Server (which is pretty much the same as
Sybase).
I was crossing my fingers for the solution to appear in
the "Ibatis implicit rollbacks" thread in the mailing
list...
What could have changed since the 2.0 release to the 2.1.7 release that could cause my SQL to stop functioning?. I'm probably doing something wrong that happens to work with the earlier 2 release but breaks in the newer release... If anyone can think of something, I'd be very glad to hear it!
Thank you very much!
-Bryan
