Hi,
I'm trying to write Jooq queries in the way the manual suggests, without a
bunch of var usage
<https://blog.jooq.org/create-empty-optional-sql-clauses-with-jooq/>, but I
can't figure out how to write an optional seek.
What I want to do is default to not seeking (for the first page) and then
when querying my second page do a seek. Right now my code is written like
this:
Optional<Cursor> after = ...;
var baseQuery = ctx.selectFrom(EXAMPLE).orderBy(EXAMPLE.CREATED_AT, EXAMPLE.
ID);
return after
.map(a -> baseQuery.seekAfter(a.createdAt.atOffset(ZoneOffset.UTC), a.
id))
.orElse((SelectSeekLimitStep<ExampleRecord>) baseQuery)
.limit(limit)
.fetchStreamInto(EXAMPLE)
.toList();
I tried using .seek(null, null) as the default, but that just causes it to
return 0 results (since there's no row with created_at > null).
Is this a case where I need to write the query dynamically like this or is
there some workaround that I'm missing?
Thanks,
Brendan
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/9aa3d6ba-895e-431c-8263-e43f21bc2e3cn%40googlegroups.com.