无法访问JdbcTemplate中的lombok生成的构造函数

我正在使用JdbcTemplate连接到oracle数据库并在表上执行SELECT语句,然后使用RowMapper捕获结果。我已经基于SELECTed列定义了POJO。

RowMapper需要一个构造函数,我正在使用lombok生成getter,setter和构造函数。 但是RowMapper无法访问构造函数,而如果我采用传统方式并定义 POJO类中的构造函数,一切工作正常。

POJO类别:

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class ProvRecordMappingPOJO {

    private String mctn_id                  ;
    private String prpr_id                  ; 
    private String prpr_entity              ;
    private String prpr_cl_eft_ind          ; 
    private String prpr_edi_dest_ind        ; 
    private String prpr_ra_dest_ind         ; 
    private String mcbd_id                  ; 
    private String mcbd_account_no          ; 
    private String mcbd_account_name        ; 
    private String mcbd_account_number_qual ;
}

DataProcessing类:

// some code here...

RowMapper<ProvRecordMappingPOJO> rowMapper = new RowMapper<ProvRecordMappingPOJO>(){

    @Override
    public ProvRecordMappingPOJO mapRow(ResultSet rs, int rowNum) throws SQLException {
        mctn_id                     = rs.getString("mctn_id")                   ;
        prpr_id                     = rs.getString("prpr_id")                   ;
        prpr_entity                 = rs.getString("prpr_entity")               ;
        prpr_cl_eft_ind             = rs.getString("prpr_cl_eft_ind")           ;
        prpr_edi_dest_ind           = rs.getString("prpr_edi_dest_ind ")        ;
        mcbr_id                     = rs.getString("mcbd_id")                   ;
        mcbr_account_no             = rs.getString("mcbd_account_no")           ;
        mcbr_account_name           = rs.getString("mcbd_account_name")         ;
        mcbr_account_number_qual    = rs.getString("mcbd_account_number_qual")  ;
        
        // getting error in below line
        return new ProvRecordMappingPOJO(
             mctn_id, prpr_id, prpr_entity, prpr_cl_eft_ind, prpr_edi_dest_ind, 
             prpr_ra_dest_ind, mcbr_id, mcbr_account_no, mcbr_account_name,
             mcbr_account_number_qual
         );  // <--- suggesting me to create constructor with parameters,
             // whereas it should be automatically created with lombok
    }
};

 // some code here...
评论