不知道为什么怎么也进不到BeanRowMapper方法里面 我用selectusermod方法去调用 可以进入 ,但是用selectmod
调用的话就不能进入
public List selectusermod(String sql){ jdbcTemplate = new JdbcTemplate(this.springdatasource().getDataSource()); return jdbcTemplate.query(sql,new RowMapperResultReader(new UserModMapper())); }
public List selectmod(String sql) {
jdbcTemplate = new JdbcTemplate(this.springdatasource().getDataSource());
System.out.println("guaiguaiguaiguaiguai");
return jdbcTemplate.query(sql,new RowMapperResultReader(new BeanRowMapper()));
} private class BeanRowMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
System.out.println("diaoyongdiayong");
Mod mod1 = new Mod();
mod1.setModId(new Integer(rs.getInt("mod_id")));
mod1.setModIcon(rs.getString("mod_icon"));
mod1.setModName(rs.getString("mod_name"));
mod1.setModParentId("mod_parent_id");
mod1.setModSeq(rs.getInt("mod_seq"));
mod1.setModShortCut(rs.getString("mod_short_cut"));
mod1.setModType(rs.getString("mod_type"));
mod1.setModUrl(rs.getString("mod_url"));
return mod1;
}
}
调用的话就不能进入
public List selectusermod(String sql){ jdbcTemplate = new JdbcTemplate(this.springdatasource().getDataSource()); return jdbcTemplate.query(sql,new RowMapperResultReader(new UserModMapper())); }
public List selectmod(String sql) {
jdbcTemplate = new JdbcTemplate(this.springdatasource().getDataSource());
System.out.println("guaiguaiguaiguaiguai");
return jdbcTemplate.query(sql,new RowMapperResultReader(new BeanRowMapper()));
} private class BeanRowMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
System.out.println("diaoyongdiayong");
Mod mod1 = new Mod();
mod1.setModId(new Integer(rs.getInt("mod_id")));
mod1.setModIcon(rs.getString("mod_icon"));
mod1.setModName(rs.getString("mod_name"));
mod1.setModParentId("mod_parent_id");
mod1.setModSeq(rs.getInt("mod_seq"));
mod1.setModShortCut(rs.getString("mod_short_cut"));
mod1.setModType(rs.getString("mod_type"));
mod1.setModUrl(rs.getString("mod_url"));
return mod1;
}
}
return jdbcTemplate.query(sql,new BeanRowMapper());
return (List) query(sql, new RowMapperResultSetExtractor(rowMapper));
}似乎没找到query 包含RowMapperResultReader这个参数的方法。不知道是不是版本不一样