left join with spring data jpa and querydsl

后端 未结 1 1271
独厮守ぢ
独厮守ぢ 2021-01-11 12:33

I am using spring data jpa and querydsl and trapped on how to write simple nice query to left join two tables. Suppose I have an Project entity and a Task entity with OneToM

相关标签:
1条回答
  • 2021-01-11 12:54

    If you want to express a constraint on tasks then you can do it like this

    QProject.project.tasks.any().id.eq(searchTerm)
    

    If you want to express preloading of certain tasks instead via a left join you can't express that via a Predicate. A Predicate in Querydsl is a boolean expression for the where, join-on and having parts of the query.

    0 讨论(0)
提交回复
热议问题