How to have multiple conditions in JPQL join

2020-03-02 02:25发布

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?

标签: jpa jpql
2条回答
仙女界的扛把子
2楼-- · 2020-03-02 02:38

Yes it is possible, there is a similar question here. However, if your entities are mapped, you should be able to access them in a query.

查看更多
放荡不羁爱自由
3楼-- · 2020-03-02 02:58

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

查看更多
登录 后发表回答