I think I found a problem in the jooq Field type hierarchy.
Lets say I start with a few TableFields. My SQL generation does some field
filtering based off of fields' tables, so later code needs to be able to
call .getTable() on them.
Now, lets say I'm joining across two tables and have two columns called ID.
In certain queries, this will create a "Duplicate column name 'id'" error
(eg if these are part of an inner subselect that gets selected out).
So, I need to alias one of my TableFields, for example
MY_TABLE.ID.as("joinedId").
However, because .as() is part of the Field interface and returns a Field,
my code that depends on a list of TableFields to do the .getTable() breaks
apart at the type level. I can't typecast back up to TableField because
.as() actually returns a different implementation under the hood.
-----
Is there any reason why the TableField interface can't override the
inherited .as() function and declare it as returning a TableField instead
of a Field? May have to play with the underlying Impl's to get it right,
but in theory, calling TableField.as() /should/ return a TableField, just
with an added alias.
Alternatively, is there a different way I can alias one of my TableFields
while still being able to later call .getTable() on it?
--
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.