查询回到int类型 类型转换

查询返回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;   }}