I have a generated field named table_name.field_name
that I can access using the TABLE_NAME.FIELD_NAME
variable generated by JooQ. Let's say that TABLE_NAME.FIELD_NAME
is a Field<Integer>
.
I would like to obtain the unqualified version of that field, namely field_name
as a Field<Integer>
. I have found the following method which seems way too verbose to me:
DSL.field(TABLE_NAME.FIELD_NAME.getQualifiedName(), TABLE_NAME.FIELD_NAME.getType());
I had hoped there would be a way that would not be so verbose, something like:
TABLE_NAME.FIELD_NAME.uq();
Am I missing something that I could use for this usecase?
I ended up making a utility method for such operations:
private <T> Field<T> relField(Field<T> field) {
return DSL.field(field.getUnqualifiedName(), field.getType());
}
This works good enough for my usecase. It would be nice to have official support for this though.