Search code examples
javasqlquerydsl

How can I do this using querydsl?


I have this part of my query which I'm transforming into querydsl and I would like to know if there's a way to achieve this transformation

Where...
...
and ce.id || ce.is_open not in (select fut_client.client_id || fut_client.is_available from future_client fut_client)")

Solution

  • Assumptions:

    • You're using querydsl-sql
    • In the sql provided || is concatenation
    • id and client_id are numbers
    • is_open and is_available are strings
    query.where(someRelationalPathBase.something.eq(someRelationalPathBase.somethingElse)
                .and(ce.id.stringValue().concat(ci.isOpen())
                .notIn(SQLExpressions.select(futClient.clientId.stringValue().concat(futClient.isAvailable))
                .from(futClient))));