hibernate查询数量

 int count= ((Integer) session.createQuery("select count(distinct sno)from Submit").iterate().next()).intValue();

报错:java.lang.Long cannot be cast to java.lang.Integer


终于改好啦:long count= ( (Long) session.createQuery("select count(distinct sno)from Submit").iterate().next()).intValue();

你可能感兴趣的:(java)