How to use multiple conditions in a JPQL join

I want to join two tables using JPQL :

 SELECT * FROM A LEFT JOIN B ON A.ID = B.A_ID AND B.lng = 'en' 

The important part is AND B.lng = 'en'

Is this possible in JPQL ?

+6
source share
2 answers

JPA 2.0 does not support the ON clause, but the JPA 2.1 project does.

EclipseLink 2.4 supports the ON clause.

See, http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/JPQL#ON

+6
source

Yes, perhaps there is a similar question . However, if your objects are mapped, you must have access to them in the request.

+1
source

Source: https://habr.com/ru/post/918461/


All Articles