Hello Sander,

> I get the impression that jOOQ currently assumes that every column can have
> just one foreign key. If there's more than one FK per column, only the first
> one it finds is generated and the others ignored (unless they're
> multi-column and picked up for another column).

Yes, this is indeed what jOOQ-meta is currently based on. I actually
wasn't aware of this being possible. The current code generator
behaviour certainly isn't correct. I have registered #2025 for this
https://github.com/jOOQ/jOOQ/issues/2025

> Is this indeed the case and is there anything that can be done about this?

I'm afraid you can probably not work around this issue except:

- if you apply some renaming tricks like you did (although, that might
not be very reliable)
- if you change your DDL

While referencing compound unique keys might seem like a good idea at
first, I always find it easier to actually reference
sequence-generated IDENTITY columns and make those ID's the primary
key within a table, instead of some unique key. It depends on how much
normalisation you want in your schema, of course. With pre-defined
codes, the CRUD is certainly easier to write, when no
sequence-generated values are involved...

Note, I'm assuming that the (code, afdeling_code) tuples are indeed
UNIQUE within the activiteit and groep tables.

Cheers
Lukas

Reply via email to