> The reason i'm using multiple foreign keys on the same column is that the
> "afdeling" of a "persoon" limits the available "groep" and "activiteit"
> records. Adding the afdeling_code in the groep and activiteit FK's assures
> that it is impossible to choose a groep or activiteit that does not match
> the chosen afdeling.

That makes sense. I've never thought about using foreign key
constraints in such a way.

>From a quick glance at the code, I think that jOOQ's core model of
referential meta data (org.jooq.UniqueKey, org.jooq.ForeignKey) will
not be affected, so this is a jOOQ-meta (and thus, jOOQ-codegen) issue
only. It shouldn't be too hard to fix.

> I have thought about adding a separate table that lists all possible
> afdeling/groep/activiteit combinations and let persoon refer to that table,
> but the problem is that although "afdeling" is mandatory, groep and
> activiteit are not.

Yes, these M:N:O:P multi-relationships are not easy to maintain and to
understand. You've probably chosen the best way to model your data.

Cheers
Lukas

Reply via email to