Commit 69e6bf28 authored by msharma's avatar msharma

Commit and rollback handled


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101092 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5400875e
...@@ -35,6 +35,8 @@ import java.sql.*; ...@@ -35,6 +35,8 @@ import java.sql.*;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.apache.poi.hssf.record.formula.functions.Stdev;
@Stateless @Stateless
public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssConfLocal,WorkorderIssConfRemote public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssConfLocal,WorkorderIssConfRemote
{ {
...@@ -704,7 +706,9 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -704,7 +706,9 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
InvAcct invAcct = new InvAcct(); InvAcct invAcct = new InvAcct();
errString = invAcct.wipPost( tranID,tranSer, conn ); errString = invAcct.wipPost( tranID,tranSer, conn );
} }
if (errString == null || errString.trim().length() == 0) System.out.println("errString from InvAcct["+errString+"]localConnection["+localConnection+"]");
//ommented by anoj dtd 04/04/2016 to commit and rollback in catch and finally block
/*if (errString == null || errString.trim().length() == 0)
{ {
if( localConnection ) if( localConnection )
{ {
...@@ -718,20 +722,23 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -718,20 +722,23 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
{ {
conn.rollback(); conn.rollback();
} }
} }*/
} }
catch(SQLException ex)
{
ex.printStackTrace();
errString = "VTCONFERR";
throw new ITMException(ex);
}
catch(Exception e) catch(Exception e)
{ {
if( localConnection )
{
try {
conn.rollback();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
e.printStackTrace(); e.printStackTrace();
errString = "VTCONFERR"; errString = "VTCONFERR";
throw new ITMException(e); //throw new ITMException(e);
} }
finally finally
{ {
...@@ -747,9 +754,23 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -747,9 +754,23 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
System.out.println("756---errString from InvAcct["+errString+"]localConnection["+localConnection+"]");
//if( conn != null && ! conn.isClosed() ) // Gulzar - 25/11/11 //if( conn != null && ! conn.isClosed() ) // Gulzar - 25/11/11
if( conn != null && !conn.isClosed() && localConnection ) //Gulzar - 25/11/11 if( conn != null && !conn.isClosed() && localConnection ) //Gulzar - 25/11/11
{ {
if(errString==null || errString.trim().length()==0)
{
conn.commit();
errString = itmDBAccessEJB.getErrorString("","VTCNFSUCC","");
}
else
{
System.out.println("Rollbacking transaction");
conn.rollback();
errString = itmDBAccessEJB.getErrorString("","VTCONFERR","");
System.out.println("errString["+errString+"]");
}
conn.close(); conn.close();
conn = null; conn = null;
} }
...@@ -757,7 +778,7 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -757,7 +778,7 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
catch(Exception e) catch(Exception e)
{ {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
throw new ITMException(e); //throw new ITMException(e);
} }
} }
return errString; return errString;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment