andreas_swe wrote:
I'll try out the composite element solution for my many-to-many relationships.
If anyone else have a comment, feel free to post me a reply on the topic!
There is no value to a composite key....you have to deal with them when you have no control over the design...but otherwise, there is never a reason to have them.
As a design rule, all of my tables have a unique key that is auto generated. In oracle with a sequence, in sql server with an identity column.
Generated keys have no business purpose...which makes them "safe". You never show them to the users...thus they never want to "renumber" them. They are not vulnerable to business rule changes. They are small...search very fast...and are totally in control.
Not to mention that any and all database tools support the concept of generated keys, single field primary keys as the easiest and most straight forward thing to do.
Thus...since composite keys offer no value at all....there really is no reason to use them.
Again, unless you've inhereted a system and can't change the design.
So yes, even my "resolve many to many join" tables have a unique, autogenerated key. Makes life much simpler.
Keep in mind the principle that good design should simplify development.
Lee