开发者

HQL distinct set

开发者 https://www.devze.com 2023-03-20 18:15 出处:网络
I have an entity that contains a set of other entities. class Foo { .... private Set<Bar> bars = new HashSet<Bar>();

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

精彩评论

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