hibernate返回Integer

StringBuffer sql = new StringBuffer("SELECT count(*) as  maxId  FROM " +tableName+" where fk_compay_id="+companyId+"");
Integer maxId = (Integer) (getSessionFactory().getCurrentSession().createSQLQuery(sql.toString()).addScalar("maxId", StandardBasicTypes.INTEGER)).uniqueResult();
return maxId;

 

posted @ 2018-12-03 17:16  缘来是妳啊  阅读(40)  评论(0编辑  收藏  举报