phoenix
phoenix

Reputation: 717

jOOQ fetch multiple records

I want to fetch a set of records from db where a field matches multiple values ( the count of which cant be predetermined ) . To exemplify,

Tables.A.ID.in(Set of IDs)
Tables.A.ID.notIn(Set of IDs)

I went through the documentation of fetchMany and fetchAny ResultQuery Documentation. I tried implementing it , but with no success.

I want to fetch all rows in DB which match the "Set of IDs" where IDs are NOT UNIQUE.

I am not able to understand how to use 'in' and 'notIn' in my pretext. Could someone show me with an example how to fetch the Set of Resulting Records from the database.

Upvotes: 1

Views: 2959

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221265

I suspect, you're simply looking for this?

Set<Integer> setOfIDs = ...

Result<Record> result = 
DSL.using(configuration)
   .select()
   .from(A)
   .where(A.ID.in(setOfIDs))
   .fetch();

Upvotes: 1

Related Questions