Commit 3934cc52 authored by skale's avatar skale

Change in code for closing statement and resultset(done by Sanjay).


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91220 ce508802-f39f-4f6c-b175-0d175dae99d5
parent eef26617
/* Developed by : TaraniseMeher
Company : Base Information Management Pvt. Ltd
Window Name : w_bom
Date :18/09/2006
Menu Reference:Master-ProductStructure-BillOfMaterial(MFG)
Button:Deactivate */
package ibase.webitm.ejb.mfg.adv; package ibase.webitm.ejb.mfg.adv;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -29,12 +23,8 @@ import javax.ejb.Stateless; // added for ejb3 ...@@ -29,12 +23,8 @@ import javax.ejb.Stateless; // added for ejb3
public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLocal , BOMDeactivateRemote //SessionBean public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLocal , BOMDeactivateRemote //SessionBean
{ {
GenericUtility genericUtility = null; GenericUtility genericUtility = null;
ConnDriver connDriver = new ConnDriver(); /* @PostConstruct
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null;
PreparedStatement pstmt = null;
@PostConstruct
public void ejbCreate() //throws RemoteException //, CreateException public void ejbCreate() //throws RemoteException //, CreateException
{ {
System.out.println("Create Method Called...."); System.out.println("Create Method Called....");
...@@ -48,7 +38,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -48,7 +38,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
e.printStackTrace(); e.printStackTrace();
System.out.println("Exception in creating Connection"); System.out.println("Exception in creating Connection");
} }
} } */
/*public void ejbRemove() /*public void ejbRemove()
{ {
} }
...@@ -56,19 +46,15 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -56,19 +46,15 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
public void ejbActivate() public void ejbActivate()
{ {
} }
public void ejbPassivate() public void ejbPassivate()
{ {
}*/ }*/
public String confirm() throws RemoteException,ITMException
public String actionHandler() throws RemoteException,ITMException
{ {
System.out.println("actionHandler() Method Called...."); System.out.println("actionHandler() Method Called....");
return ""; return "";
} }
public String confirm(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException
public String actionHandler(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
String retString = null; String retString = null;
...@@ -100,14 +86,19 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -100,14 +86,19 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
int count = 0; int count = 0;
java.sql.Timestamp today = null; java.sql.Timestamp today = null;
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null;
PreparedStatement pstmt = null;
try try
{ {
if(conn==null) if(conn==null)
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
} }
/* conn.setAutoCommit(false);
connDriver = null; */
System.out.println("xtraParams : " + xtraParams); System.out.println("xtraParams : " + xtraParams);
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
...@@ -118,8 +109,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -118,8 +109,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
retString = itmDBAccessEJB.getErrorString("","VMEMPORD2","","",conn); retString = itmDBAccessEJB.getErrorString("","VMEMPORD2","","",conn);
} }
if(bomCode!=null) if(bomCode!=null)
{ {
sql = "SELECT ACTIVE FROM BOM WHERE BOM_CODE = ?"; sql = "SELECT ACTIVE FROM BOM WHERE BOM_CODE = ?";
System.out.println("Setting Parmeter:::"+bomCode); System.out.println("Setting Parmeter:::"+bomCode);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -132,6 +122,8 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -132,6 +122,8 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
System.out.println("Bom Code : " + bomCode + " Active : [" + active + "]"); System.out.println("Bom Code : " + bomCode + " Active : [" + active + "]");
rs.close(); rs.close();
pstmt.close(); pstmt.close();
rs = null;
pstmt = null;
if(active.trim().equalsIgnoreCase("N")) if(active.trim().equalsIgnoreCase("N"))
{ {
System.out.println("Active : " + active); System.out.println("Active : " + active);
...@@ -148,6 +140,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -148,6 +140,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
pstmt.setString(3,chgUser); pstmt.setString(3,chgUser);
int rowsUpdated = pstmt.executeUpdate(); int rowsUpdated = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null;
System.out.println("No of Rows Updated in BOM : [" + rowsUpdated +"]"); System.out.println("No of Rows Updated in BOM : [" + rowsUpdated +"]");
if(rowsUpdated > 0 ) if(rowsUpdated > 0 )
{ {
...@@ -159,7 +152,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -159,7 +152,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
conn.rollback(); conn.rollback();
itmDBAccessEJB.getErrorString("","VTBOMACT1",chgUser); itmDBAccessEJB.getErrorString("","VTBOMACT1",chgUser);
} }
} }
} }
catch (SQLException se) catch (SQLException se)
{ {
...@@ -175,10 +168,18 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc ...@@ -175,10 +168,18 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
} }
finally finally
{ {
try{ try
conn.close(); {
conn = null; if(conn != null)
pstmt.close(); {
conn.close();
conn = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}catch(Exception e){} }catch(Exception e){}
} }
return retString; return retString;
......
...@@ -11,6 +11,6 @@ import javax.ejb.Local; // added for ejb3 ...@@ -11,6 +11,6 @@ import javax.ejb.Local; // added for ejb3
public interface BOMDeactivateLocal extends ActionHandlerLocal//,EJBObject public interface BOMDeactivateLocal extends ActionHandlerLocal//,EJBObject
{ {
public String actionHandler() throws RemoteException,ITMException; public String confirm() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException; public String confirm(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
} }
\ No newline at end of file
...@@ -11,6 +11,6 @@ import javax.ejb.Remote; // added for ejb3 ...@@ -11,6 +11,6 @@ import javax.ejb.Remote; // added for ejb3
public interface BOMDeactivateRemote extends ActionHandlerRemote//, EJBObject public interface BOMDeactivateRemote extends ActionHandlerRemote//, EJBObject
{ {
public String actionHandler() throws RemoteException,ITMException; public String confirm() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException; public String confirm(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
} }
\ No newline at end of file
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