The join condition With ON clause in the Jpql

Hi,

I am trying to run query in CollectionLoader which has join with on clause. Since i dont want to add relationship between two table internally i am trying to fetch result by adding join with on clause in Jpql so that i can getResults and also i can able to use filters search on browse screen.

Kindly help me to understand if we can add Join with on clause in JPQL or if any other way to acheive the same also i can able to use filters of browse screen from other solution.

Query :

SELECT e FROM cases e LEFT JOIN userCaseAllocation a ON e.caseId = a.caseId

Query

SELECT e FROM cases e

return same result* as

SELECT e FROM cases e LEFT JOIN userCaseAllocation a ON e.caseId = a.caseId

*if case has 0…1 userCaseAllocation.

IMHO if a.caseId is foreing key you not need ON clause. JPQL uses foreign key to join tables:

SELECT e FROM cases e LEFT JOIN userCaseAllocation a
1 Like

Thank you for solution