implement querydsl join
implement querydsl join
The documentation http://querydsl.com/static/querydsl/2.2.0/reference/html/ch02s02.html seems to have a different idea than me about what should be in on(predicate). It seems that the actual 'on' predicate is always implied to be a matching of the ids (i.e: kitten.id in ( cat.kittens.id ) , while the example shows the on(predicate) to simply be a filter on the rhs. I expect that the on() would contain the actual join predicate - such as kitten.color in (cat.kittens.color).
query.from(cat)
.leftJoin(cat.kittens, kitten)
.on(kitten.bodyWeight.gt(10.0))
.list(cat);
from Cat as cat
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0
I find the mongodb test case an implementation equally confusing. QuerydslMongoPredicateExecutorIntegrationTests
List<Person> result = new SpringDataMongodbQuery<>(operations, Person.class).where()
.join(person.coworker, QUser.user).on(QUser.user.username.eq("user-2")).fetch();
Note that the test case is an inner-join (not outer-join) and returns the (only) Person that has a matching coworker. The on() is only used for selecting the matching User(s). It is not used for the join - the predicate for the join is implied to be person.coworker.id = user.id
join is implemented in QueryDSL support. But it only facilitates something like 'satisfies'.