1Z0-898 · Question #29
The embeddable class ContractInformation is used in an element collection of the Employee entity. @Entity Public class Employee { @Id int empId; @ElementaryCollection Set <ContractInformation> info…
The correct answer is B. @Embeddable Address address; C. @ManyToOne phone phone. B:Embeddable classes have the same rules as entity classes but are annotated with the javax.persistence.Embeddable annotation instead of @Entity. Example:@EmbeddedZipCode zipCode; C:@ManyToOnedDefines a single-valued association to another entity class that has many-to- one…
Question
The embeddable class ContractInformation is used in an element collection of the Employee entity. @Entity Public class Employee { @Id int empId; @ElementaryCollection Set <ContractInformation> info; . . . } Assume that the phone class is an entity and that address is an embedded class. Which two of the code segments below can be used to model the state of ContractInformation? (Choose two)
Options
- A@OneToMany Set <phone> phones;
- B@Embeddable Address address;
- C@ManyToOne phone phone;
- D@ElementaryCollection <Phone> phones;
- E@OneToOne Address address;
How the community answered
(52 responses)- A10% (5)
- B85% (44)
- D4% (2)
- E2% (1)
Explanation
B:Embeddable classes have the same rules as entity classes but are annotated with the javax.persistence.Embeddable annotation instead of @Entity. Example:@EmbeddedZipCode zipCode; C:@ManyToOnedDefines a single-valued association to another entity class that has many-to- one multiplicity. public class Employee { @Embedded JobInfo jobInfo; public class JobInfo { String jobDescription; @ManyToOne ProgramManager pm; // Bidirectional
Topics
Community Discussion
No community discussion yet for this question.