Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hint on how to represent jave Object with two relation tables

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I would like help/hints regarding the design of this situation:

This is a fictitious example, Say I have users in support group and teaching group, each user can be present in several groups.
Say Dave is in support group a,b,c and in teaching group x,y
tables:
users
user_identifier
support_groups
support_group_identifier
users_in_support_group
user_identifier
support_group_identifier

teaching_groups
teaching_group_identifier
users_in_teaching_group
user_identifier
teaching_group_identifier


I thought User can be abstract containing just Identifier,
And to have AssignedToSupportGroupUser, AssignedToTeachingGroupUser
AssignedToSupportGroupUser will inherit User and will include the support_group_id
Support Group object will hold List<AssignedToSupportGroupUser>

I am debating about the JAVA side design, I will appreciate some general guidelines or an example url..
Sorry for my lame English...

 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand, but seems you just should have,

User
- id
- ManyToMany List<SupportGroup> supportGroups
- ManyToMany List<TeachingGroup> teachingGroups

SupportGroup
- id
- ManyToMany List<User> users

TeachingGroup
-id
- ManyToMany List<User> users
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic