Offer way around accumulation of keys in composite-key in join tables with attribute class!
It's well known. When we create a join table for a many-to-many associations, the keys of both joining classes are combined to become the composite key of the rows of the join table. Furthermore, if we have some attributes (sometimes called joined attributes) on the join table and we encapsulate those attributes in a class, that newly created class must carry the composite-key of the row where it is stored.
In complex applications, the newly created class (joined attribute class) is also subject to having its own associations. If this class has a many-to-many association with another class with composite-key, then we start having an accumulation of keys in composite-key(s). That's obviously a problem.
This number of keys in the composite key can grow and grow. I work on a social network application and we have some joined attribute classes with 4 accumulated keys (4 long integers). That's too much! There has to be a better way!
My suggestion: I speak here of XML metadata. I suggest that you either extend the capabilities of <idbag> element or create a new element with the capabilities that I will describe.
The solution is to allow the creation of new key in the join table of the many-to-many association. Element <idbag> does something very similar, but currently it can't be used in many-to-many join tables with attributes. This new key will be the key of the association attribute class. Instead of a composite key of two keys, now it only has one key. This way, composite-keys would disappear from many-to-many association join tables with attributes.
|