Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
using sub-query in jooq's seek api

I am evaluating using JOOQ in our solution where we expose data using REST API and checking if the following feature can use jooq's seekAfter and seekBefore api.

suppose i have a table like

CREATE TABLE Test (
  Id Int NOT NULL PRIMARY KEY,
  Sid varchar(34) NOT NULL,
  ....
)

We want to do paging using the Id field, but don't want to expose it to the user. We hand out next and previous paging arguments as tokens as part of response.

currently we are building query like

SELECT ... FROM Test WHERE Id > (SELECT Id FROM Test WHERE Sid=?) LIMIT 10;

Is it possible to give it an expression to jooq's seek api instead of literal values ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You could do something along the lines of this:

// Assuming this static import:
import static org.jooq.impl.DSL.*;

DSL.using(configuration)
   .select()
   .from(TEST)
   .orderBy(TEST.ID)
   .seekAfter(field(select(TEST.ID).from(TEST).where(TEST.SID.eq(sid))))
   .limit(10)
   .fetch();

Essentially, this is wrapping a Select<? extends Record1<T>> type in a Field<T> type with DSL.field(Select)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!