//DAO层我的订单的个数统计
public Integer findByCountUid(Integer uid) {
String hql="select count(*) from Order o where o.user.uid=? ";
List<Long> list= this.getHibernateTemplate().find(hql,uid);
return list.get(0).intValue();
}
这里的List<Long> 为何不用Integer接收。
...全文
2209打赏收藏
Hibernate 贼简单的问题。
//DAO层我的订单的个数统计 public Integer findByCountUid(Integer uid) { String hql="select count(*) from Order o where o.user.uid=? "; List list= this.getHibernateTemplate().find(hql,uid); return list.get(0).intValue(); } 这里的List 为何不用Integer接收。
ava.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
cn.xx.shop.order.dao.OrderDao.findByCountUid(OrderDao.java:27)
cn.xx.shop.order.service.OrderService.findByPageUid(OrderService.java:41)
6了。我的版主。确实返回的Long默认。我去掉了上面的泛型。debug看到的。确实是。