Valid 1Z0-898 Dumps shared by ExamDiscuss.com for Helping Passing 1Z0-898 Exam! ExamDiscuss.com now offer the newest 1Z0-898 exam dumps, the ExamDiscuss.com 1Z0-898 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com 1Z0-898 dumps with Test Engine here:
The department entity has a unidirectional OneToMany 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?
Correct Answer: B
Explanation/Reference: Annotation Type MapKey specifies 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 the map. Example: @ Entity public class Department { . .. @ OneToMany(mappedBy="department") @ MapKey(name="name") public Map<String, Employee> getEmployees() {... } . .. } @Entity public class Employee { @ Id public Integer getEmpId() { ... } . .. @ ManyToOne @ JoinColumn(name="dept_id") public Department getDepartment() { ... } ... } Reference: javax.persistence, Annotation Type MapKey