Hi I am using array in the modal class.But I am having problem in the dao layer in the function i have created.Is this the proper way to pass variable to an array in model class as i have used;


This is my model class named as payrollTypeOutDto

Code:
public class PayRollTypeOutDto implements Serializable {
            private String pay_Id;
            private String payroll_Type;
            private String[] selectHeader;
            private String[] header_pay;
            private String[] header_type;

    public PayRollTypeOutDto(){
        
    }

    public PayRollTypeOutDto(String[] header_pay, String[] header_type) {
        this.header_pay = header_pay;
        this.header_type = header_type;
    }

    public String getPay_Id() {
        return pay_Id;
    }

    public void setPay_Id(String pay_Id) {
        this.pay_Id = pay_Id;
    }

    public String getPayroll_Type() {
        return payroll_Type;
    }

    public void setPayroll_Type(String payroll_Type) {
        this.payroll_Type = payroll_Type;
    }

    public String[] getSelectHeader() {
        return selectHeader;
    }

    public void setSelectHeader(String[] selectHeader) {
        this.selectHeader = selectHeader;
    }

    public String[] getHeader_pay() {
        return header_pay;
    }

    public void setHeader_pay(String[] header_pay) {
        this.header_pay = header_pay;
    }

    public String[] getHeader_type() {
        return header_type;
    }

    public void setHeader_type(String[] header_type) {
        this.header_type = header_type;
    }

    @Override
    public String toString() {
        return "PayRollTypeOutDto{" +
                "pay_Id='" + pay_Id + '\'' +
                ", payroll_Type='" + payroll_Type + '\'' +
                ", selectHeader=" + (selectHeader == null ? null : Arrays.asList(selectHeader)) +
                ", header_pay=" + (header_pay == null ? null : Arrays.asList(header_pay)) +
                ", header_type=" + (header_type == null ? null : Arrays.asList(header_type)) +
                '}';
    }
}
This is my function in dao layer
Code:
public PayRollTypeOutDto getPayRollType() {
        final String methode_name = "PayRollTypeOutDto getPayRollType()";

        String comSql = "SELECT pay_head_name,addition_deduction FROM payhead group by addition_deduction,pay_head_name order by addition_deduction desc";
        SqlRowSet srs = this.jdbcTemplate.queryForRowSet(comSql);
        int i = 0;
        PayRollTypeOutDto payRollTypeOutDto=null;
        while (srs.next()) {
        payRollTypeOutDto = new PayRollTypeOutDto();
            payRollTypeOutDto.setHeader_pay(new String[]{srs.getString("pay_head_name")});
            payRollTypeOutDto.setHeader_type(new String[]{srs.getString("addition_deduction")});

            i++;
        }
        return payRollTypeOutDto;

    }

This is my controller part

Code:
     @RequestMapping("/payrolltype.htm")
    public String showPayRollType(ModelMap model, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException {
       String methodeName = "showPayRollType() /payrolltype.htm";

try{
         PayRollTypeInDto payrollTypeInDto = new PayRollTypeInDto();
         model.addAttribute("payrolltype",payrollTypeInDto);
          MasterDaoExt2 masterdaoExt2 = new MasterDaoImpExt2(this.jdbcTemplate);

           System.out.println("yyyyyyyyyyyyyyy"+masterdaoExt2.getPayRollType());
          httpServletRequest.setAttribute("rollList", masterdaoExt2.getPayRollType());

}catch(Exception e){
          System.out.println("err");
    JCLogger.log(CLASS, methodeName, " Going to load :::dto::"+ e.getMessage(), JCLogger.INFO);
}