hibernate sum函数求总和 得到的 使用query.uniqueResult()方法得到是一个Long 但是我action里面需要一个int
我该怎么做 我的方法如下 但是不知道这样有没有什么潜在的问题?
求高人指教:
Action:
   int already_input_sum=storeService.get_can_input_sum_tounumber(plancode);
service:
    public int get_can_input_sum_tounumber(String plancode) {
   Long  l= storeDao.get_can_input_sum_tounumber(plancode);
   int i=0;
   long ll=l;
   if(l!=null){
   i=(int)ll;  
   }
return i;
   }
Dao :
    public Long get_can_input_sum_tounumber(String plancode) {
String hql="select sum(tounumber) from InStoreInfo where plancode=? and inuse=0 and   
                              plantype=2 and isAgree in(-1,1)";
Query query=sf.getCurrentSession().createQuery(hql);
query.setParameter(0, plancode);
Long l=(Long) query.uniqueResult();
return l;
}