Commit a7a51fc6 authored by vvengurlekar's avatar vvengurlekar

rollback statement added if updation failed- MiscPayablesHld.java, MiscPayablesRls.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@181901 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 285a1273
...@@ -44,6 +44,7 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld ...@@ -44,6 +44,7 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld
System.out.println("returning from MiscPayablesHld actionHandler"+retString); System.out.println("returning from MiscPayablesHld actionHandler"+retString);
return retString; return retString;
} }
@SuppressWarnings("unused")
private String actionHold(String tranID, String xtraParams)throws ITMException private String actionHold(String tranID, String xtraParams)throws ITMException
{ {
Connection conn = null; Connection conn = null;
...@@ -58,6 +59,7 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld ...@@ -58,6 +59,7 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld
float adjAmt=0; float adjAmt=0;
float holdAmt=0; float holdAmt=0;
float balAmt=0; float balAmt=0;
boolean flag = false;
try try
{ {
conn = getConnection(); conn = getConnection();
...@@ -98,13 +100,16 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld ...@@ -98,13 +100,16 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld
errCode="VTHOLD3"; errCode="VTHOLD3";
} }
if((errCode != null && errCode.trim().length() == 0) && rows > 0) if((errCode == null && errCode.trim().length() == 0) && rows > 0)
{ {
errCode = "VTHOLD2"; errCode = "VTHOLD2";
conn.commit(); conn.commit();
System.out.println("\n <==== Transaction Updated Successfully ====>"); System.out.println("\n <==== Transaction Updated Successfully ====>");
} }
else
{
flag = true;
}
if (errCode != null && errCode.trim().length() > 0) if (errCode != null && errCode.trim().length() > 0)
{ {
System.out.println("MiscPayablesHld:errCode:"+errCode); System.out.println("MiscPayablesHld:errCode:"+errCode);
...@@ -123,16 +128,23 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld ...@@ -123,16 +128,23 @@ public class MiscPayablesHld extends ActionHandlerEJB implements MiscPayablesHld
{ {
if (conn != null) if (conn != null)
{ {
if(flag)
{
conn.rollback();
}
if (rs != null) if (rs != null)
rs.close(); {
rs = null; rs.close();
rs = null;
}
if (stmt != null) if (stmt != null)
stmt.close(); {
stmt = null; stmt.close();
stmt = null;
}
conn.close(); conn.close();
conn = null; conn = null;
} }
conn = null;
} catch (Exception d) } catch (Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
......
...@@ -44,6 +44,7 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls ...@@ -44,6 +44,7 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls
return retString; return retString;
} }
@SuppressWarnings("unused")
private String actionRelease(String tranID,String xtraParams)throws ITMException private String actionRelease(String tranID,String xtraParams)throws ITMException
{ {
Connection conn = null; Connection conn = null;
...@@ -58,6 +59,7 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls ...@@ -58,6 +59,7 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls
float adjAmt=0; float adjAmt=0;
float holdAmt=0; float holdAmt=0;
float balAmt=0; float balAmt=0;
boolean flag = false;
try try
{ {
conn = getConnection(); conn = getConnection();
...@@ -96,12 +98,16 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls ...@@ -96,12 +98,16 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls
errCode="VTHOLD3"; errCode="VTHOLD3";
} }
if((errCode != null && errCode.trim().length() == 0) && rows > 0) if((errCode == null && errCode.trim().length() == 0) && rows > 0)
{ {
errCode = "VTHOLD1"; errCode = "VTHOLD1";
conn.commit(); conn.commit();
System.out.println("\n <==== Transaction Updated Successfully ====>"); System.out.println("\n <==== Transaction Updated Successfully ====>");
} }
else
{
flag = true;
}
if (errCode != null && errCode.trim().length() > 0) if (errCode != null && errCode.trim().length() > 0)
{ {
System.out.println("MiscPayablesRls:errCode:"+errCode); System.out.println("MiscPayablesRls:errCode:"+errCode);
...@@ -119,16 +125,23 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls ...@@ -119,16 +125,23 @@ public class MiscPayablesRls extends ActionHandlerEJB implements MiscPayablesRls
{ {
if (conn != null) if (conn != null)
{ {
if(flag)
{
conn.rollback();
}
if (rs != null) if (rs != null)
rs.close(); {
rs = null; rs.close();
rs = null;
}
if (stmt != null) if (stmt != null)
stmt.close(); {
stmt = null; stmt.close();
stmt = null;
}
conn.close(); conn.close();
conn = null; conn = null;
} }
conn = null;
} catch (Exception d) } catch (Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
......
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