hibernate hql distinct
2008-08-03 14:15
hibernate hql distinct
在 hibernate的reference 中提到过hql是可以直接使用distinct的

--
关键字distinct与all 也可以使用,它们具有与SQL相同的语义.
select distinct cat.name from Cat cat
select count(distinct cat.name), count(cat) from Cat cat
--

所以,我就尝试使用
select distinct c.* from Column c, 在hql中,使用 * 必须要用到别名的
查询出的结果是 null来的.
在mysql 中,这种写法是没有错的,..然后我再试了一下
select distinct c from Column c , 这样得出的结果是非null,是正确的.