IncorrectResultSetColumnCountException: Incorrect column count: expected 1, actual 38

前端 未结 4 1872
刺人心
刺人心 2021-02-12 22:18

I am using JdbcTemplate to retrieve a Bean from the db. Here is my method:

public List  getTrackerData() {
    return List         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-12 22:59

    Implementing Bean RowMapper Interface and maprow function solve this problem

    public class Mmitrackerv3LivedataMapper implements RowMapper {
    
    @Override
    public Mmitrackerv3Livedata mapRow(ResultSet rs, int rowNum)
            throws SQLException {
    }
    

    And Now I have Change In JDBC Template

     List live = jdbcTemplate.query("select * from mmitrackerv3_livedata mlive " + 
     "join mmitrackerv3_device mdevice on mlive.accountid = mdevice.accountid where mlive.accountid = " +
         aid, new Mmitrackerv3LivedataMapper());
    

    Thanks @abhishek

提交回复
热议问题