Configuring many-to-many relationships

We will now configure Course and Student entities for a many-to-many relationship (a course can have many students, and one student can take many courses).

Many-to-many relations could be unidirectional or bidirectional. For example, you may only want to track students enrolled in the courses (so the Course entity will have a list of students) and not students taking the courses (the Student entity does not keep a list of courses). This is an unidirectional relationship where only the Course entity knows about the students, but the Student entity does not know about the courses).

In a bidirectional relationship, each entity knows about the other one. Therefore, the Course entity will keep a list of students ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.