can someone explain me how to write a query about a many-to-many relation?
I have the following classes: Person and Category. A person can habe many categories. In Person, there is a set called categories, and in Category, there is a set with the name persons. The primaryKey of Category is called categoryId.
Now, I want to get all persons mit categoryId = 1. I tried the following queries:
1. select p from Person p join p.categories c where c.categoryId = 1
2. select p from Person p, in (p.categories) c where c.categoryId = 1
I get always null, but I know that there is an entity, which has the categoryId = 1.