A developer who is designing entity classes to map a legacy database encounters a table called STUDENT_RECORD.
This table has two columns, STUDENT_ID and STUDENT_INFO_ID. The primary key of this table consists of both columns, and there is a unique constraint on each info column.
The STUDENT_ID column is foreign key to the STUDENT table and STUDENT_INFO_ID column is a foreign key to the STUDENT_DAT table.
What entity classes and relationships can the developer use to model these tables and relationship?(Choose two)
A.
Model the student table as a student entity and STUDENT_DATA table StudentData entity.
Model the STUDENT_RECORDS table as bidirectional many-to-many relationship between the student entity on the student data entity.
B.
Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the STUDENT_RECORD table as a bidirectional one-to-one relationship between the student entity and the StudentData entity.
C.
Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the Student-Records table as a student record entity. Create a many-to-one one relationship from the StudentRecord entity to the student entity and many-to-one relationship from the StudentRecord entity entity to the Student entity and many-to-one relationship from the student entity to the StudentData entity and one-to-many relationship from the StudentData entity to the StudentRecord entity.
D.
Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the STUDENT-RECORD table as a StudentRecord entity. Create a bidirectional one-to-one relationship between the StudentRecord entity and bidirectional one-to-one relationship between the Student Record entity and the Student Data entity.
ِAnswer B, D
The problem statement clearly specifies that both the columns of STUDENT_RECORD have unique constraints on them.
This means neither of the values can be repeated in multiple rows. Therefore, you cannot have a many relationship on any side. This is a OneToOne relationship.
It could be modeled as a bidirectional or unidirectional OneToOne.
AC is correct. Because unique constraint is set on column STUDENT_INFO_ID. So, such records are possible.
STUDENT_ID STUDENT_INFO_ID
1 11
1 12
1 13
2 21
2 22
A and C are correct.
STUDENT STUDENT_RECORD STUDENT_DATA
STUDENT_RECORD.PK = (STUDENT_ID, STUDENT_INFO_ID)
STUDENT_INFO_ID is unique
===> 1:n association between Student and StudentData.
===> A and C are correct
A join table is not required but is a possible solution to implement 1:n associations
STUDENT &bsp;&bsp;<–>&bsp;&bsp; STUDENT_RECORD &bsp;&bsp;<–>&bsp;&bsp; STUDENT_DATA
STUDENT STUDENT_RECORD STUDENT_DATA
B, D because unique constraint on each info column