( (Integer) session.iterate("select count(*) from ....").next() ).intValue()
这样可以在不返回结果集的情况下得到结果数量,适用于只查询记录的数量的操作。