开发者

Something like "contains any" in HQL

The following (simplified) classes are mapped to the database via Hibernate:

class SystemUser {
    Set<UserGroup> groups;
}

class UserGroup {
    Set<Integer> permissions;
}

How can I select all SystemUsers with a certain permission, say permissio开发者_开发百科n 3, with HQL?


Perhaps something like this:

select distinct u from SystemUser u join u.groups g 
where 3 in elements(g.permissions)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜