I have two classes: User
and Event
.
The user can:
- Create an event.
- Comment on an event.
I want to know if I can create more than one association between event and user? Thank you for any references.
You can create as many associations between classes as you need. There is no limit. You should add association-end names to clarify the purpose of each association, since without them the model will just not make much sense.
However, in your example you have one association class and a normal association. That could go without association ends.
I agree with Thomas. You can create as many associations between classes as you need. You should also use association-end names to clarify your model and provide properties to navigate across the association.
Moreover, you should consider making a Comment
a normal class in its own right, so you can add the semantics of made by one User
and made about one Event
. The way you have it modeled, you disallow multiple Comments
from one User
on one Event
. Why would you want that?
Comment
association class is just a class sitting between the two linked classes allowing to allow many relations.
May 12, 2016 at 17:49