QueryDsl - subquery in collection expression

后端 未结 2 669
灰色年华
灰色年华 2020-12-24 15:12

I\'m using spring-data-jpa and querydsl (3.2.3)
I have a scenario where I\'m creating set of predicates based on user filer/input. All of these comes to BooleanEx

2条回答
  •  自闭症患者
    2020-12-24 16:06

    Here is a variant of jaiwo99's answer in a more JPAesque form

    BooleanExpression exp = invoice.supplier.number.in(new JPASubQuery()
        .from(company)
        .where(company.active.isTrue())
        .list(company.nu‌​mber));
    

    Feel free to merge this into the original answer.

提交回复
热议问题