queryDSL any()。concat

时间:2015-01-20 14:32:16

标签: jpa querydsl

请帮忙,

我如何从一对多关系中连接属性?

order.users.any().firstName
    .concat(order.users.any().lastName)
    .containsIgnoreCase(request.fullName)

这给出了一个奇怪的例外:

org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "user4_"

1 个答案:

答案 0 :(得分:0)

在进行双向映射和使用JPASubQuery时,这有用。

BooleanBuilder builder = new BooleanBuilder();
...
JPASubQuery from = new JPASubQuery()
                    .from(QOrderUnit.orderUnit)
                    .where(QOrderUnit.orderUnit.orderBatch.eq(orderBatch).
                            and(QOrderUnit.orderUnit.firstName.concat(" ").concat(QOrderUnit.orderUnit.lastName)
                                    .containsIgnoreCase(orderRequest.getOwners())));
builder.and(from.exists());