Search code examples
javasqljooq

How to get real table filed name with JOOQ Field?


I want to get table filed real name by JOOQ Field, contains table name and field name. I use the following two methods,

BOOK.TITLE.getName(); // title   it doesn't contains table name
BOOK.TITLE.toString(); // dev.book.title   it contains schema name

how to get book.title by JOOQ Field


Solution

  • Generated fields implement TableField, which has a TableField.getTable() method.

    Another approach would be to call Field.getQualifiedName() and then call Name.qualifier() to get the (again) qualified name of the table, if your field is Name.qualified().