nerdexam
Oracle

1Z0-898 · Question #54

The developer wants to override the default mappings for an embeddable class Address used by the customer entity. The Address class is defined as follows: @Embeddable public class Address ( private…

The correct answer is A. @AttributeOverrides ({. Annotation Type Embedded Defines a persistent field or property of an entity whose value is an instance of an embeddable Here we have @Embedded Address addr; AttributeOverridesis used to override mappings of multiple properties or fields. @AttributeOverrides({…

JPA Fundamentals

Question

The developer wants to override the default mappings for an embeddable class Address used by the customer entity. The Address class is defined as follows:

@Embeddable public class Address ( private String street; private String city; private String country; . . . ) Assume that NO mapping descriptor is present. Which code segment below shows the correct way to override the default mapping for address?

Options

  • A@AttributeOverrides ({
  • B@ AttributeOverrides ({
  • C@ AttributeOverrides ({
  • D@AttributeOverrides ({

How the community answered

(43 responses)
  • A
    84% (36)
  • B
    9% (4)
  • C
    2% (1)
  • D
    5% (2)

Explanation

*Annotation Type Embedded Defines a persistent field or property of an entity whose value is an instance of an embeddable Here we have @Embedded Address addr; *AttributeOverridesis used to override mappings of multiple properties or fields. @AttributeOverrides({ @AttributeOverride(name="startDate", column=@Column(" EMP_START")), @AttributeOverride(name="endDate", column=@Column("EMP_END")) }) public EmploymentPeriod getEmploymentPeriod() { ... }

Topics

#@AttributeOverrides#embeddable override#column mapping#@Embeddable

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice