Commit a6c6e288 authored by prane's avatar prane

sql and prepare sql commented and added outside of loop for batchupdate

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188510 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d323af9f
......@@ -303,6 +303,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
int upd=0;
boolean status=false ,flg = true;
int[] batchCount;
int noOfRow = 0;
String itemCode="";
String acctAnalysis="";
String[] analysisStr =null;
......@@ -974,6 +975,12 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
// }
} // end of amountRadj !=0
//below sqlInsert and prepare sql added outside of loop Pavan R 31jul18
sqlInsert =" insert into misc_drcr_rdet "
+" (tran_id,line_no,acct_code,cctr_code,amount,emp_code,anal_code)"
+" values (?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(sqlInsert);
sql =" select acct_code,cctr_code,case when sum(tax_amt) is null then 0 else sum(tax_amt) end as taxAmt, "
+" case when sum(reco_amount) is null then 0 else sum(reco_amount) end as recoAmount "
+" from taxtran where tran_code= ? and "
......@@ -1022,12 +1029,12 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
cctrCodeReco = cctrCode;
}
System.out.println("inserting into misc_drcr_rdetselect acct_code,cctr_code,sum(nvl(tax_amt,0))");
sqlInsert =" insert into misc_drcr_rdet "
//below sql and prepare sql commented and added outside of loop Pavan R 31jul18
/*sqlInsert =" insert into misc_drcr_rdet "
+" (tran_id,line_no,acct_code,cctr_code,amount,emp_code,anal_code)"
+" values (?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(sqlInsert);
pstmtInsert = conn.prepareStatement(sqlInsert);*/
if(status && flg)
{
miscRdetListMap = new HashMap();
......@@ -1047,6 +1054,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.setString(6,"");
pstmtInsert.setString(7,"");
pstmtInsert.addBatch();
pstmtInsert.clearParameters();
//adding values to miscRdetListMap
miscRdetMap = new HashMap();
miscRdetMap.put("tran_id", tranId);
......@@ -1067,16 +1075,16 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
// throw new Exception("UpdateFail");
// }
// }
noOfRow ++;
}// end while
if(!isPreview)
{
if(pstmtInsert!=null)
if(pstmtInsert!=null && noOfRow > 0)
{
batchCount =pstmtInsert.executeBatch();
System.out.println("nos of row inserted "+batchCount.length);
pstmtInsert.close();
pstmtInsert=null;
}
rs.close();
rs = null;
......@@ -1086,6 +1094,12 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}//end of isPreview
//taking reco_amount
//below sqlInsert and prepare sql added outside of loop Pavan R 31jul18
noOfRow = 0;
sqlInsert =" insert into misc_drcr_rdet "
+" (tran_id,line_no,acct_code,cctr_code,amount,emp_code,anal_code)"
+" values (?,?,?,?,?,?,?)";
pstmtInsert=conn.prepareStatement(sqlInsert);
sql =" select line_no, acct_code__reco,cctr_code__reco, "
+" case when sum(reco_amount) is null then 0 else sum(reco_amount) end as recoAmount "
......@@ -1223,10 +1237,11 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
{
if(!isPreview)
{ //if isPreview
sqlInsert =" insert into misc_drcr_rdet "
//below sql and prepare sql commented and added outside of loop Pavan R 31jul18
/*sqlInsert =" insert into misc_drcr_rdet "
+" (tran_id,line_no,acct_code,cctr_code,amount,emp_code,anal_code)"
+" values (?,?,?,?,?,?,?)";
pstmtInsert=conn.prepareStatement(sqlInsert);
pstmtInsert=conn.prepareStatement(sqlInsert);*/
// if(status && flg)
// {
miscRdetListMap = new HashMap();
......@@ -1251,6 +1266,7 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
pstmtInsert.setString(6,"");
pstmtInsert.setString(7,"");
pstmtInsert.addBatch();
pstmtInsert.clearParameters();
}
//adding values to miscRdetListMap
miscRdetMap = new HashMap();
......@@ -1325,15 +1341,17 @@ public class MiscDrCrRcpConf extends ActionHandlerEJB implements MiscDrCrRcpConf
}
//}//end of isPreview condition
// }
noOfRow ++;
}// end while
if(!isPreview){
if(pstmtInsert !=null)
if(pstmtInsert !=null && noOfRow > 0)
{
batchCount =pstmtInsert.executeBatch();
System.out.println("nos of row inserted "+batchCount.length);
pstmtInsert.close();
pstmtInsert =null;
noOfRow = 0;
}
......
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