Guten Tag Thorsten Schöning,
am Freitag, 31. Januar 2020 um 13:15 schrieben Sie:

> CTEs are query-level and therefore not part of the classes jOOQ
> generates based on some schema for Java, that's why I wonder how to
> best handle names of CTEs themself, the columns they produce etc.

I tried following the approach jOOQ is doing by simply creating
classes with fields for each CTE and their columns. In theory the CTE
itself is the same like a table jOOQ would generate columns for, so I
as well really created one field per column per CTE.

The problem is that things feel bloated already after converting only
one of my queries. I've attached an example again.

The only alternative coming into my mind is outsourcing the individual
SELECT-statements into a view, for which jOOQ would create classes
etc. automatically again. But doing this for each and every CTE for
each and every report in question doesn't feel that right as well.
Every change in any CTE would involve a change in the database schema,
where it seems far easier to change Java-code instead.

The good thing on creating fields and stuff manually for all the CTEs
is that types are available everywhere needed and one doesn't need to
handle that within the query itself. Like in "cte.field(...)" one can
simply reference an already available field definition and jOOQ takes
that name, type etc. At other places, only the name of that field
could be used as needed.

Still need to think about this...

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: [email protected]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

-- 
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/21689665.20200131190600%40am-soft.de.

Attachment: CteDefs.java
Description: Binary data

Attachment: CteUsage.java
Description: Binary data

Reply via email to