posted 14 years ago
Hi Friends,
I have a two number say FROMNUMBER and TONUMBER in a formBean , Like this i have ArrayList of FormBeans , Now my requirement is to insert each individual number into one table.So i am using Batchs to add all the number.
The code is a follows----------
for(int i=0;i<primarySuccess.size();i++){
PrimaryUploadForm primaryForm=new PrimaryUploadForm();
primaryForm=(PrimaryUploadForm)primarySuccess.get(i);
for(long u=primaryForm.getSeriesFrom();u<=primaryForm.getSeriesTo();u++){
statement5.setInt(1,maxTrans);
statement5.setString(2,primaryForm.getItemCode());
statement5.setString(3,u+"");
statement5.setString(4,"");
statement5.setString(5,primaryForm.getInvoiceNumber());
// statement5.executeUpdate();
statement5.addBatch();
statement5.clearParameters();
}}
statement5.executeBatch();
if there are totally 1,25,000 numbers , if i use batchs only some number are getting inserted(some 12,000) numbers
but if i comment the addBatch and use executeUpdate() then each individual record getting inserted but its taking more time to insert the records,
Please suggest some solution for this problem.
>