开发者

HQL distinct set

I have an entity that contains a set of other entities.

class Foo {
    ....
    private Set<Bar> bars = new HashSet<Bar>();
    ....
}

class Bar {开发者_Python百科
    private long id;
    private String name;
    ....
}

Is it possible to do a HQL distinct query to get a list of all the unique Sets?

select distinct f.bars from Foo f 

only returns the distict list of all Foo's


Try:

select distinct elements(f.bars) from Foo f
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜