Hi Marcel,

Thank you very much for your questions

2016-06-06 15:57 GMT+02:00 Marcel Overdijk <[email protected]>:

> Maybe even taking it a little bit further.
> Would it be possible if I have a org.jooq.Query that I can construct a
> new Query object from it with an added orderBy, offset and limit?
>

One of the types you might want to look into is the SelectQuery (construct
it via DSLContext.selectQuery()). jOOQ currently has very distinct DSL APIs
(feel like SQL) and model APIs (help constructing dynamic SQL). Details
here:
http://www.jooq.org/doc/latest/manual/sql-building/sql-statements/dsl-and-non-dsl

The two APIs currently don't work together very well, you'll have to decide
between one of them. We're planning on improving this for jOOQ 4.0

As it stands now, your solution is probably as good as it gets - although:


   - You could factor out creating the base query in a method / function
   and implementing the count / pagination in a generic utility
   - Beware that currently, both DSL and model APIs are mutable to some
   extent. If you're adding LIMIT / OFFSET, you will *modify* your base query
   (also for the other usages). This is best remedied by creating new queries
   for every use-case.

Note that if you're using a databse that supports window functions, you can
calculate the COUNT value also using COUNT(*) OVER() in a single query

On Monday, June 6, 2016 at 3:01:50 PM UTC+2, Marcel Overdijk wrote:
>
>>
>> PS: would it be a good idea to start a jooq gitter room for discussions?
>>
>
Sure, but inertia and the fact that a lot of users are following this group
is prohibiting "quick moves" towards new media. Can you pitch gitter to me?

Advantages of a mailing list:
- They're "offline", so no one expects an immediate reply. This is better
for reflected feedback and for keeping our support work low.
- They're archived and easily searchable, also on third party websites
(e.g. gmane: http://blog.gmane.org/gmane.comp.java.jooq.user)
- They're easy to moderate
- They're well understood for support use-cases

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to