views:

184

answers:

1

I've got the following situation:

A User object has a Set of Permission objects (Set) Each User can have zero or more Permissions A Permission object has three fields The three fields of Permission up make up the composite key for that permission. As a consequence of this, we want exactly one instance in the DB of each Permission. Each user can potentially have the same Permission. The User object therefore has a many-to-many relationship with Permission.

The question is: how, in this situation, do I make the Permission entity a composite key of itself? I'm particularly interested in doing this in the context of this many-to-many relationship.

Any ideas?

+3  A: 
Arthur Ronald F D Garcia