Posted By:
Pizzinelli_Alberto
Posted On:
Thursday, May 16, 2002 02:16 AM
I created a system that stores the information of a Student - Course m:n relationship. The relationship at database schema level is kept by a third table called Enrollments that has in addition at the foreign keys of the other two tables some fields that stores the datetime of creation, etc...(It's a fake m:n relationship. Really I use two 1:n relationships between the three tables) I've created three entity beans StudentEJB,EnrollmentEJB,CourseEJB(matching the corresponding table fields). In the deployment descriptor I specified two 1:n relationships. One for StudentEJB-EnrollmentEJB and one for CourseEJB-EnrollmentEJB When I deployed the application I expected that in my database (it's Oracle but it doesn
More>>
I created a system that stores the information of a Student - Course m:n relationship.
The relationship at database schema level is kept by a third table called Enrollments that has in addition at the foreign keys of the other two tables some fields that stores the datetime of creation, etc...(It's a fake m:n relationship. Really I use two 1:n relationships between the three tables)
I've created three entity beans StudentEJB,EnrollmentEJB,CourseEJB(matching the corresponding table fields). In the deployment descriptor I specified two 1:n relationships. One for StudentEJB-EnrollmentEJB and one for CourseEJB-EnrollmentEJB
When I deployed the application I expected that in my database (it's Oracle but it doesn't matter) there were three tables for data (Student - Enrollment - Course), but I got the following situation:
Five tables: Student, Enrollment, Course,
Student-Enrollment(the 1st 1:n
relationship), Course-Enrollment (the 2nd 1:n relationship)
(Entity Beans: StudentEJB,EnrollmentEJB,CourseEJB)
In my database the last two tables are unnecessary.
Why J2ee force the creation of another table per relationship?
<<Less