Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个 HQL 查询,它返回包含在给定日期之前创建的给定用户的所有组。不知何故,我无法正确处理。
public class Group { @ManyToMany Set<User> users; Date created; } public class User { ... }
II-Bhima 的回答基本上是正确的——这里有一个小修复:
select g from Group as g inner join g.users as user where g.created < :createdDate and user = :user
您需要它以便返回 Groups 而不是 Object[] 与 Group-User 2-tuples。