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({…
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)- A84% (36)
- B9% (4)
- C2% (1)
- D5% (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
Community Discussion
No community discussion yet for this question.