hibernate 中 hql distinct注意事项

hql中 正常使用distinct没有任何问题,但是distinct和order by一起使用 就会有问题: 例如:User对象有 id、name、age三个属性 hql  :select distinct name,id from User order by age 这条hql 是有问题的,hibernate是无法执行,会报错。 正确写法:select distinct name,id,age
相关文章
相关标签/搜索