Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
JPQL/JPA query with collections
Hi!
I hope that this is the right forum. I have a simpe datamodel like Company----products.category. I tried to make a select with JPQL like that:
Query q = em.createQuery("SELECT x FROM Company x WHERE x.products.category='"+cProduct+"'");
I got that:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: |Exception Description: Error compiling the query [SELECT x FROM Company x WHERE x.products.category=''], line 1, column 32: invalid navigation expression [x.products.category], cannot navigate collection valued association field [products].
So is it even possible to make a selection like that with JPA or am I just doing something wrong? Any ideas?
Thanks!
Sami