@Entity
@Table(name="users")
public class User implements Serializable
{
private List<Request> sentRequest;
private List<Request> receivedRequest;
private Profile profile;
}
public List<Object> getUserProfiles(Integer userid)
{
query = em.createQuery(
"SELECT p from Profile p1,Profile p2 WHERE " +
"p1.user.sentRequest.sender.id (:id) NOT IN " +
" p2.user.receivedRequest.receiver.id and " +
"p1.user.id NOT IN (:id)"
).setParameter("id",userid);
我在上面尝试查询它是非法尝试取消引用收集。 这种关系是 用户 - 配置文件OneToOne和用户 - 请求OneToMany
我想选择那些尚未发送请求的用户个人资料以及自己的个人资料。
答案 0 :(得分:1)
问题在于代码的这一部分p1.user.sentRequest.sender.id (:id) NOT IN
参数必须在NOT IN
之后p1.user.sentRequest.sender.id NOT IN (:id)