@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中取消下划線。