Qualify function not for jOOQ OSS?

17 views
Skip to first unread message

adithya kamath

unread,
Jun 20, 2023, 6:52:40 AM6/20/23
to jOOQ User Group
I'm trying to implement qualify using 
    var result2 = ctx.select(PRODUCT_MASTER.PRODUCT_LINE,
        PRODUCT_MASTER.PRODUCT_NAME, PRODUCT_MASTER.PRODUCT_SCALE)
        .from(PRODUCT_MASTER)
        .qualify(rowNumber().over().orderBy(PRODUCT_MASTER.PRODUCT_LINE.desc()).between(start, end))
        .fetchInto(ProductMaster.class)


But I'm getting data access exception saying it is not available for OSS, but Saw some links like this which show it can be used with OSS. Some other examples like this and this showing it is available for OSS. Possibly I'm missing something, or a simple part of the above that is not OSS?

adithya kamath

unread,
Jun 20, 2023, 6:53:35 AM6/20/23
to jOOQ User Group

Just realised, it's a slightly more complicated first part before qualify with joins

Lukas Eder

unread,
Jun 20, 2023, 7:02:43 AM6/20/23
to jooq...@googlegroups.com
Hi Adithya,

Thanks for your message. The QUALIFY clause is available in all editions if the underlying dialect supports it natively. To emulate it, we use the QUALIFY to derived table transformation, a transformation that relies on commercial API, and is thus only available in commercial editions, see:

It's probably worth referring to that transformation section from the QUALIFY section of the manual. I'll change that right away.

I hope this helps,
Lukas

--
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 jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/7628394e-e00c-4011-bbae-b7a145bbe34dn%40googlegroups.com.

adithya kamath

unread,
Jun 20, 2023, 7:49:12 AM6/20/23
to jOOQ User Group
Hey Lukas, 
That's a bummer but I see where you're coming from. So then guess I can just add rowNumber in the SELECT statement and use the good ol' where.

Lukas Eder

unread,
Jun 20, 2023, 8:25:45 AM6/20/23
to jooq...@googlegroups.com
Yeah, SQL transformation is a power use feature that most users of the jOOQ Open Source Edition don't need. In the meantime there have been 2-3 out of the box transformations added to jOOQ, which rely on this framework, unlike most other emulations which are much simpler.

But as you said, you can implement this emulation manually using a derived table. Or, in your particular case, why not just use ORDER BY .. OFFSET .. FETCH? Is your actual query much more complex?

adithya kamath

unread,
Jun 20, 2023, 9:12:52 AM6/20/23
to jOOQ User Group
Saw some videos by Hussein Nasser and some other answers on the same. That offset, limit might not be the most optimal approach, so was thinking of using something like keyset pagination. 

Lukas Eder

unread,
Jun 20, 2023, 9:55:21 AM6/20/23
to jooq...@googlegroups.com
But filtering by ROW_NUMBER() isn't keyset pagination, that's OFFSET pagination.
jOOQ has native support for keyset pagination via the SEEK clause:

Reply all
Reply to author
Forward
0 new messages