Discussions

EJB design: Entity relation with an attached value field

  1. Entity relation with an attached value field (3 messages)

    I have a system with two Entity beans, User and Module. And a User can have a certain permission to a Module. That means, the two entities have a relation, and this relation has a "permission" field attached to it.

    My question is how to model this, is it possible to define a relation with the extra field, or do I have to set up this using a special UserPermission-bean?

    Regards
     Johan
  2. I have a system with two Entity beans, User and Module. And a User can have a certain permission to a Module. That means, the two entities have a relation, and this relation has a "permission" field attached to it.My question is how to model this, is it possible to define a relation with the extra field, or do I have to set up this using a special UserPermission-bean?Regards Johan
    I would have another entity bean called UserModule that has a field called permission and would relate User--UserModule and UserModule--Module with CMR.

    Kingshuk
  3. Of course at this point you may also want to ask yourself how come such a simple requirement led to the complexity of three Entity Beans.

    David
  4. Of course at this point you may also want to ask yourself how come such a simple requirement led to the complexity of three Entity Beans.David
    :-) I get the point. May be I missed something obvious. Can you suggest something else ?

    My assumption was a user can have access to more than one module, and permission for each module could be different.

    If user has access to only one module then permission could be a field in the User bean itself and the CMR is between User and Module.