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
精彩评论