nerdexam
Oracle

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…

Entity Relationships

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)
  • A
    10% (5)
  • B
    85% (44)
  • D
    4% (2)
  • E
    2% (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

#ElementCollection#Embeddable#embeddable restrictions#element collection constraints

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice