0
我想要一個單一的HQL查詢,它返回包含給定用戶的所有組,該組在給定日期之前創建。不知何故,我無法做到。如何爲此編寫HQL查詢?
public class Group
{
@ManyToMany
Set<User> users;
Date created;
}
public class User
{
...
}
我想要一個單一的HQL查詢,它返回包含給定用戶的所有組,該組在給定日期之前創建。不知何故,我無法做到。如何爲此編寫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
你需要它,以便組返回,而不是與集團用戶2元組對象[]。