java - Combine plain SQL and DSL in SQL query in jOOQ -


i have complex plain sql query (with subselects, multiple joins, database specific functions) use jooq's dsl generating e.g. order clause.

what achieve is:

dsl     .using(datasource)     .select("select column table")     .orderby(dsl.fieldbyname("column")) 

which jooq transforming to:

select * (select column table) q order q.column; 

can done?

you're close. following possible:

dsl.using(datasource, dialect)    .select()    .from("(select column table) t")    .orderby(dsl.field("t.column")); 

you have wrap (and depending on sql dialect, rename) derived table explicitly yourself.

note i'm using dsl.field(), not dsl.fieldbyname(), latter produces case-sensitive column reference. plain sql query have produce case-sensitive column reference.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -