时间:2021-07-01 10:21:17 帮助过:56人阅读
//查询当前店铺 -自定义类别
public List findShopCovertype(String shopCode){
String sql = "SELECT A.shop_code
,A.cover_type_code
,A.cover_type_name
FROM shop_cover_type
A WHERE A.shop_code
= ?";
final List list = new ArrayList();
shopcoverTypeDao.getJdbcTemplate().query(sql, new Object[]{shopCode},new RowCallbackHandler(){
@Override
public void processRow(ResultSet rs) throws SQLException {
// TODO Auto-generated method stub
ShopCoverType sct = new ShopCoverType();
sct.setCoverTypeCode(rs.getString("cover_type_code"));
sct.setShopCode(rs.getString("shop_code"));
sct.setCoverTypeName(rs.getString("cover_type_name"));
list.add(sct);
}
});
return list;
}
这是我本地的一个方法 在linux下会报错 看我的sql 是 String sql = "SELECT A.`shop_code`,A.`cover_type_code`,A.`cover_type_name` FROM `shop_cover_type` A WHERE A.`shop_code` = ?";from shop_cover_type在linux下 hibernate 查的是 from cx. shop_cover_type因此会报错找不到这个表 (Table 'cx.shop_cover_type' doesn't exist)很多表都是这样前面多了个 cx.第一次把项目布到linux 遇到很多问题 谢谢大jia