Supposing I have to model a relationship between two entity beans, say, Student and Course (the mastering ejb2 example). A Student can enroll in multiple courses, and a Course has many students who enrol for it. At the database level, I have a third table which models the relationship between the two, an Enrollment table.
The tables look like :
What i'm not sure of is: How does one model this using bean relationships? Should there be a direct relationship between Student and Course ? Or should there be an Enrollment bean as well to model two 1:N relationships ?