Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda