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;
......@@ -30,11 +24,7 @@ import javax.ejb.Stateless; // added for ejb3
public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLocal , BOMDeactivateRemote //SessionBean
{
GenericUtility genericUtility = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null;
PreparedStatement pstmt = null;
@PostConstruct
/* @PostConstruct
public void ejbCreate() //throws RemoteException //, CreateException
{
System.out.println("Create Method Called....");
......@@ -48,7 +38,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
e.printStackTrace();
System.out.println("Exception in creating Connection");
}
}
} */
/*public void ejbRemove()
{
}
......@@ -56,19 +46,15 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String actionHandler() throws RemoteException,ITMException
public String confirm() throws RemoteException,ITMException
{
System.out.println("actionHandler() Method Called....");
return "";
}
public String actionHandler(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException
public String confirm(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException
{
Document dom = null;
String retString = null;
......@@ -100,14 +86,19 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
int count = 0;
java.sql.Timestamp today = null;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null;
PreparedStatement pstmt = null;
try
{
if(conn==null)
{
conn = connDriver.getConnectDB("DriverITM");
}
/* conn.setAutoCommit(false);
connDriver = null; */
System.out.println("xtraParams : " + xtraParams);
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
......@@ -119,7 +110,6 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
}
if(bomCode!=null)
{
sql = "SELECT ACTIVE FROM BOM WHERE BOM_CODE = ?";
System.out.println("Setting Parmeter:::"+bomCode);
pstmt = conn.prepareStatement(sql);
......@@ -132,6 +122,8 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
System.out.println("Bom Code : " + bomCode + " Active : [" + active + "]");
rs.close();
pstmt.close();
rs = null;
pstmt = null;
if(active.trim().equalsIgnoreCase("N"))
{
System.out.println("Active : " + active);
......@@ -148,6 +140,7 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
pstmt.setString(3,chgUser);
int rowsUpdated = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("No of Rows Updated in BOM : [" + rowsUpdated +"]");
if(rowsUpdated > 0 )
{
......@@ -175,10 +168,18 @@ public class BOMDeactivate extends ActionHandlerEJB implements BOMDeactivateLoc
}
finally
{
try{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}catch(Exception e){}
}
return retString;
......
......@@ -11,6 +11,6 @@ import javax.ejb.Local; // added for ejb3
public interface BOMDeactivateLocal extends ActionHandlerLocal//,EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String confirm() 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
public interface BOMDeactivateRemote extends ActionHandlerRemote//, EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String confirm() 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