hibernate执行sql语句
public ResultSet writeXml() throws HibernateException, SQLException {
Session session = getSession();
ResultSet rs = null;
String sql = "select count(cardname) as count,cardname from tb_dk_orderinfo group by cardname order by count desc";
// 获取connection,执行静态SQL
Statement state = session.connection().createStatement();
rs = state.executeQuery(sql);
session.close();
return rs;
}
这段代码执行的时候会抛异常:query did not return a unique result: 10
sql语句执行出来的结果是会返回多条记录,这样写不可以执行这样的语句吗?