首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

查询回到int类型 类型转换

2012-09-06 
查询返回int类型 类型转换public Integer getCount() {List a nulltry {String hql select count(*)

查询返回int类型 类型转换

public Integer getCount() {   List a = null;   try {    String hql = "select count(*) from EcsPhoto";    a = super.getSession().createQuery(hql).list();    Object oc = a.get(0);    if (oc instanceof Integer) {     Integer count = (Integer) a.get(0);     return count.intValue();    } else {     Long log = (Long) a.get(0);     return log.intValue();    }   } catch (Exception e) {    e.printStackTrace();    return 0;   }}

热点排行