Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have multiple conditions in JPQL join

Tags:

jpa

jpql

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?

like image 248
Jeremy S. Avatar asked Jun 19 '12 12:06

Jeremy S.


1 Answers

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

EclipseLink 2.4 supports an ON clause.

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

like image 97
James Avatar answered Sep 18 '22 00:09

James