@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void getAll() {
String sql="select * from t_resource_location limit 0,10";
List<ResourceLocationBean> abc=jdbcTemplate.query(sql, new BeanPropertyRowMapper(ResourceLocationBean.class));

for(int i=0;i<abc.size();i++)
{
System.out.println(abc.get(i).getId());
}
}

 

经测试,发现实体BEAN的属性与表的字段可以一一对应,也可以是表的字段里面有下划线,而在BEAN中取消下划线。

相关文章:

  • 2021-11-23
  • 2022-12-23
  • 2022-03-09
  • 2021-12-18
  • 2022-01-14
  • 2021-09-05
  • 2021-10-08
  • 2021-10-18
猜你喜欢
  • 2019-03-28
  • 2021-09-25
  • 2022-12-23
  • 2021-11-15
  • 2021-10-02
  • 2021-08-18
  • 2021-10-01
相关资源
相似解决方案