I have two classes Student and Class in @ManyToMany relationship. I would like to select all classes in which student (id = 1) is not. How can I do it?
Asked
Active
Viewed 95 times
1 Answers
0
You will have to user MEMBER OF
and equivalent in Critera API
. Here you have some details http://www.objectdb.com/java/jpa/query/jpql/collection.
In your case it will be something like
cb.isMemberOf(student,c.get("students"));
where student
is Student entity, and c
is query root - Class.

Antoniossss
- 31,590
- 6
- 57
- 99