Is there a way to programmatically list all the Fields which are a Foreign Key in jOOQ? It generates a lot of static constants to foreign keys, but there is no good way to programmatically access these.
Example, I have a table Orders
with a foreign key field customer_id
. In jOOQ, say I have a reference to said table object for Orders
, there does not appear to be a way to programmatically get a reference to the customer_id
jooq field object. So my only solution now is to manually make these mappings somewhere using a literal map datastructure. Seems like jooq would have been able to do this for me, am I missing something?
There are many ways to navigate the jOOQ meta model. Your description isn't complete, but I'm assuming, you would want to do something like this:
for (ForeignKey<?, ?> fk : ORDERS.getReferencesTo(CUSTOMER))
for (Field<?> fkField : fk.getFields())
System.out.println(fkField);