JPA - left join 2 tables without association

database, entity, join, jpa

Solution

This is possible with JPA with following query:

FROM A as a, B as b WHERE b.col1=a.col1 OR b.col1 IS NULL

Problem

I have 2 tables/entities with no association. I can go for cross joins in JPA ``` FROM A as a, B as b WHERE b.col1=a.col1 ``` How Can I perform a left-join? I want all values from A and fill them up with B values where possible and leave NULL where there is no B. Does not work: ``` FROM A as a LEFT JOIN B as b WHERE b.col1=a.col1 ``` Path expected for join! Invalid path: 'b.col1'

Original source