You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Bing Qiao <qi...@gmail.com> on 2005/08/15 12:30:10 UTC
IMPLICIT_TRANSACTIONS and sqlmap Transaction
Hello,
I'm using sqlmap transaction in java to call a stored procedure:
/******************************************/
try {
Treasury.startTransaction();
rtn = ServiceFacade.updateActionStatus(this.getPayment().
getPaymentid());
if (rtn) {
Treasury.commitTransaction();
}
}
finally {
Treasury.endTransaction();
}
public static boolean updateActionStatus(int paymentid) {
try {
sqlmap.update("updateActionStatus", new Integer(paymentid));
}
catch (Exception e) {
return false;
}
return true;
}
/***************************************************/
updateActionStatus is mapped to a stored procedure.
It seems that to make the transaction work, I can't use SET
IMPLICIT_TRANSACTIONS OFF in this stored procedure without putting
something like a query before it.
In other words, if I call two stored procedures in the transaction
block. If the first one is a query and the second one an update with
SET IMPLICIT_TRANSACTIONS OFF in it. The transaction works.
However, if the update is called first, the transaction does not work.
BTW, the update stored procedure has its own transactions too.
I could drop the SET IMPLICIT_TRANSACTIONS OFF to make it work. But
there are dozens of others. Could somebody advice a right way to use
both sqlmap transaction in java and MS SQL Server's transactions in
stored procedures. And how to handle the SET IMPLICIT_TRANSACTIONS
OFF.
Thanks very much!
Bqiao