How to have multiple conditions in JPQL join

廉价感情. 提交于 2019-12-04 01:17:40

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/11100702/how-to-have-multiple-conditions-in-jpql-join

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!