Link to home
Start Free TrialLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag for India

asked on

Could you please modify my program to insert multiple records

could you please modify my program to insert multiple records in Databas

could you please give me the code to insert multiple records using for loop,list and input DTO from junit test case          

 public  void testAdd() {
           System.out.println("testAdd");
                CustomBillerDTO inputDTO = new CustomBillerDTO();
                CustomBillerListDTO outputDTO = new CustomBillerListDTO();
                CustomBillerListDTO outputListDTO = new CustomBillerListDTO();
                List<CustomBillerDTO> arrInputList=new ArrayList<CustomBillerDTO>();
                AuditDTO auditDTO=new AuditDTO();
               // inputDTO.setLegalVehicleCode("LV17");
                inputDTO.setBillerCode("NSEL18");
                inputDTO.setBillUpLoadType("Y");
                inputDTO.setPayPressFlag("1");                
                auditDTO.setActiveStatusFlag("AA");                          
                auditDTO.setMakerCode("M");
                auditDTO.setCheckerCode("C");
                auditDTO.setWorkBranchCode("133");
                auditDTO.setChannelSource("1"); //ACC_CHA
                auditDTO.setMakerRemarks("MRE"); //ACC_MAKER
                auditDTO.setCheckerRemarks("CRE"); //ACC_CHEC
                inputDTO.setCurrentActiveStatusFlag("A");                      
                inputDTO.setAuditDTO(auditDTO);
                arrInputList.add(inputDTO);
                outputListDTO.setList(arrInputList);
                outputDTO=target.add(outputListDTO);
                System.out.println("Added");
                               }
            }

   
Avatar of Manikandan Thiagarajan
Manikandan Thiagarajan
Flag of India image

ASKER

above code to insert only one reocrd

give me the code to insert multiple records
Avatar of Dejan Pažin

Which sentence inserts the object into database? I cant find it, please expalin.

And what does JUnit have to do with all of this?
this code is insert the data into database

outputDTO=target.add(outputListDTO);
                System.out.println("Added");
ASKER CERTIFIED SOLUTION
Avatar of Mehdi Javan
Mehdi Javan
Flag of Finland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial