I’m experimenting with JPA queries but keep getting an error on the following query
SELECT p
FROM usertype_permissions up
JOIN permissions p ON up.PERMISSION_ID = p.ID
WHERE up.USERTYPE_ID = 1
Error:
Caused by: java.lang.IllegalArgumentException: An exception occurred while
creating a query in EntityManager:
Exception Description: Syntax error parsing the query
[SELECT p
FROM usertype_permissions up
JOIN permissions p ON up.PERMISSION_ID = p.ID
WHERE up.USERTYPE_ID = 1].
In JPQL you have to use Entity names (by default it’s the name of the Java class), to me it looks weird that
usertype_permissionsis an Entity name / Java class…It looks like you are using table names and the word after join has to refer to an attribute of a class e.g.
l.booksExample:
a JPQL query would look like this: