Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7501837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:40:11+00:00 2026-05-29T20:40:11+00:00

I have two entity classes, Student and Committee. I can not post images, but

  • 0

I have two entity classes, Student and Committee.

I can not post images, but image of current db design can be found here:
current db design

or in text:

**Committee**
id
name

**students_committees**
stud_id
com_id

**students**
name
gender
grade

students can be in many committees, and a committee has many students.

Now I want to add a leader to committee (a committee can have more than 1 leader).
What is the best way to do this?

  1. Add another join table: committee_leaders(stud_id, com_id)
  2. Add extra column to the existing join table: students_committees(stud_id, com_id, is_leader)
  3. Something else?

I would assume an extra join table is the best choice. We would not need to traverse the entire current join table to find the leaders for a committee. My team does not agree.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:40:12+00:00Added an answer on May 29, 2026 at 8:40 pm

    My choice would be option 1 if the points 2 and 3 below matter in your case. If not, option 2 is simpler.

    Pros (vs option 2):

    1. (as you pointed) you would not need to traverse the entire current join table to find the leaders for a committee. You’ll just join committee with committee_leaders. (not much difference though, you’ll be just searching a smaller index, the difference may be negligible.)

    2. you can easily enforce the constraint that a committee has no more than one leader.

    3. if you want to add other attributes for the leaders, like when the leader was chosen (elected), what other title they gain, etc, you’ll not be filling the studens_committees table with columns that will be NULL almost everywhere.

    Cons:

    1. leaving the committe would require DELETEs on 2 tables (or 1 with cascading delete in effect).

    2. inserting a new student as leader will require two INSERTs in 2 tables.

    3. changing the leader in a committee will require one DELETE and one INSERT vs 2 UPDATEs (possibly in one statement).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two entity classes annotated in the following way @Entity class A {
I have two Entity classes: Order and OrderItem . Order contains a navigation property
I have the two entity classes, User and MyCharacter. User has a list of
In my program I have two classes: Collector and Entity. Collector stores Entities in
I have two classes: News : /** @Entity @Table(name=news) */ class News { /**
I have two classes: abstract Entity , abstract ClassA extends Entity , ClassB extends
I have two entity classes: public class Invoice { public int ID { get;
I have two entity classes: Person and Position . public class Person { public
Let's say I have two Entity classes: SocialApp and SocialAppType In SocialApp I have
I have the following scenario (in Java / Hibernate): I have two entity classes:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.