6

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below.

Database Diagram

Is this design good ?

Any suggestions for improvement are more than welcome.

I am also confused about what Entity classes should I create for this. Especially for College_Major, should there be an Entity class for this or it should only be a mapping table created for many-to-many mapping between College and Major?

If the latter is a better case, how can the Admission_Form table refer to a Major in a College?

In either case, what should Entity classes (if good to have) for College_Major and Admission_Form look like?

migrated from stackoverflow.com Jan 5 '15 at 16:54

This question came from our site for professional and enthusiast programmers.

  • 5
    One major mistake - given college fee inflation, double is probably inadequate to work long term. – DVK Jan 5 '15 at 20:30
1

Looks a fairly solid design apart from the college_major area which seems to be giving you problems as well :)

Personally, I would split this table into two:

  1. Change the College_Major table to be a true many to many resolver (i.e. no intake int). This would become a reference table which is only changed when a college establishes a new major.
  2. Intake, which links to College_Major and has the 1:* relationship to admission. I suspect that the intake date should be added, since it should not be possible to enrol a student for a non-existing course.

I like your use of id fields (aka business neutral primary keys). For consistency, the Student table primary key should probably be named student_id rather than just id.

You might like to give some thought to the name Admission_Form. It looks like the database is recording a successful admission, which may not always come from a form, and some forms may never result in an admission.

You will need a an entity class for each table except possibly College_Major. If I remember correctly, Hibernate can handle many to many relationship using collections (e.g College will have a list of majors, and major will have a list of colleges).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.