@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);
我尝试了上面的查询,它抛出了非法的取消引用集合的尝试。关系是
User - Profile OneToOne 和 User - Request OneToMany
我想选择所有未发送请求的用户配置文件,但自己的配置文件除外。