Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to left join unrelated entities?

Tags:

jpa

hql

querydsl

When i try to run a query like this:

QA A = QA.a;
QB B = QB.b;
...
from(A)
.leftJoin(B).with(B.name.eq(A.nameSomething));

(A and B entities are not related) I'm always getting this error:

Caused by: org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!

I would like to be able to left join unrelated entities using querydsl. Is it possible at all? Or the only way is to write a native Oracle query?

like image 425
lorak Avatar asked Sep 15 '14 13:09

lorak


1 Answers

Joining unrelated entities is not possible with Querydsl JPA. Querydsl JPA uses JPQL internally and inherit's this restriction.

like image 168
Timo Westkämper Avatar answered Dec 01 '22 08:12

Timo Westkämper