jOOQ - query builder with IN predicate

Viewed 768

I am trying to build a query like this:

List<Integer> ids = ...

String query = DSL.select(TABLE.SOMETHING).from(TABLE).where(TABLE.ID.in(ids)).
getSQL();

But I am not able to get the generated query with the values, just the placeholders. I tried DSL.inline(ids) but it doesnt' work.

How can I do this?

I am using jOOQ 3.4.2.

Thanks for the help.

UPDATE:

Seems I can do this with:

    Configuration configuration = new DefaultConfiguration();
    configuration.set(SQLDialect.DERBY);
    Settings settings = new Settings()
    .withStatementType(StatementType.STATIC_STATEMENT);
    configuration.set(settings);
    DSLContext create = DSL.using(configuration);

    String query = create.select(TABLE.SOMETHING).from(TABLE).where(TABLE.ID.in(ids)).getSQL();

If someone can confirm that is th right way, thanks.

1 Answers
Related