On Wednesday, December 19, 2012 5:20:25 PM UTC+1, Lukas Eder wrote: > 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 >
Thanks Lukas! > 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... > 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. 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.
