1Z0-898 · Question #53
The department entity has a unidirectional One To Many relationship to the employee entity. The developer wants to model this relationship as a java.util.map such that the key of map is true…
The correct answer is B. @OneToMany @mapKey (name, "name") map < integer, Employee> Employees. Annotation Type MapKeyspecifies the map key for associations of type java.util.Map when the map key is itself the primary key or a persistent field or property of the entity that is the value of
Question
The department entity has a unidirectional One To Many relationship to the employee entity. The developer wants to model this relationship as a java.util.map such that the key of map is true employee name. The primary key of the Employees entity is empId, an integer. Which of the following is correct?
Options
- A@OneToMany (targetEntity = Employee.class)
- B@OneToMany @mapKey (name, "name") map < integer, Employee> Employees;
- C@OneToMany @MapKeyJoinColumn (name = "name") map <String, Employee>
- D@OneToMany @mapsId (name = "name") map <String, Employee> employees;
How the community answered
(32 responses)- A9% (3)
- B81% (26)
- C3% (1)
- D6% (2)
Explanation
Annotation Type MapKeyspecifies the map key for associations of type java.util.Map when the map key is itself the primary key or a persistent field or property of the entity that is the value of
Topics
Community Discussion
No community discussion yet for this question.