Data modeling question

1
A newbie to Mendix here and I have a question with a scenario I have for data modeling. Say I have two simple entities like below where one employee may be assigned to multiple projects.    However, an employee can have a specific role in a project, for example, 'employee-A' has a 'developer' role on 'project-B' and has a 'lead' role in 'project-C'. So, it is not appropriate to store the 'role' attribute on the 'Employees' nor on the 'Projects' entity! What is the best way to handle this in Mendix? Edit - Adding updated model below based on various inputs -    
asked
3 answers
4

Hi,

You could add an extra entity called 'projectrole' to do this and link this entity to a project as well as an employee!.

Furthermore, check out Rom's remark, your assocation projects_employees now says that a project only has 1 employee, you might want to turn this the other way around if you wish, or make it a many * - to - many * association!

answered
2

Also very important: please keep your association lines straight to improve readability :)

answered
1

Hi Sunil,

Your domain model should look something like this: 

  1. An Employee Can be part of multiple projects through the ProjectMember entity -> I assume the employee will be involved in multiple projects over time
  2. Each project can have mu;tiple pProjectMembers, each projectMember refer to a single Employee
  3. Per ProjectMember object; a select can be done on the project role
    1. Either using the attribute ProjectRole, which is enum with fixed list of roles
    2. Either by selecting a role from the entity Project Role over association => dynamic list
      Choose which fits your goal

 

Check also this lecture: https://gettingstarted.mendixcloud.com/link/module/123/lecture/1009
and this one: https://gettingstarted.mendixcloud.com/link/module/123/lecture/1080
Or start at the beginning; https://gettingstarted.mendixcloud.com/link/path/38

p.s. please use singular names for your entities; you will thank me later ;-)

 

answered