* Align startDBProcess with startProcess transaction semantic

This commit is contained in:
Heng Sin Low 2007-01-29 11:52:00 +00:00
parent 559c45aeb4
commit 85ddbcd144
1 changed files with 13 additions and 0 deletions

View File

@ -597,16 +597,29 @@ public class ServerBean implements SessionBean
public ProcessInfo dbProcess(ProcessInfo processInfo, String procedureName, String trxName) public ProcessInfo dbProcess(ProcessInfo processInfo, String procedureName, String trxName)
{ {
String sql = "{call " + procedureName + "(?)}"; String sql = "{call " + procedureName + "(?)}";
Trx trx = null;
if (trxName != null)
trx = Trx.get(trxName, true);
try try
{ {
CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, trxName); CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, trxName);
cstmt.setInt(1, processInfo.getAD_PInstance_ID()); cstmt.setInt(1, processInfo.getAD_PInstance_ID());
cstmt.executeUpdate(); cstmt.executeUpdate();
cstmt.close(); cstmt.close();
if (trx != null && trx.isActive())
{
trx.commit(true);
trx.close();
}
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
if (trx != null && trx.isActive())
{
trx.rollback();
trx.close();
}
processInfo.setSummary (Msg.getMsg(Env.getCtx(), "ProcessRunError") + " " + e.getLocalizedMessage()); processInfo.setSummary (Msg.getMsg(Env.getCtx(), "ProcessRunError") + " " + e.getLocalizedMessage());
processInfo.setError (true); processInfo.setError (true);
} }