1Z0-898 · Question #45
An entity person is mapped to a table PERSON and has a collection-valued persistence field otherUsedNames that stores names used by a person. The other used Names field is mapped to a separate table…
The correct answer is D. @ElementCollection. CollectionTableSpecifies the table that is used for the mapping of collections of basic or embeddable types. Applied to the collection-valued field or property. Example:@Entity public class WealthyPerson extends Person { @ElementCollection @CollectionTable(name="HOMES") // use…
Question
An entity person is mapped to a table PERSON and has a collection-valued persistence field otherUsedNames that stores names used by a person. The other used Names field is mapped to a separate table called NAMES. Which code fragment correctly defines such field?
Options
- A@ElementCollection (name = "NAMES")
- B@Element collection
- C@ElementCollection
- D@ElementCollection
How the community answered
(40 responses)- A3% (1)
- B10% (4)
- C5% (2)
- D83% (33)
Explanation
CollectionTableSpecifies the table that is used for the mapping of collections of basic or embeddable types. Applied to the collection-valued field or property. Example:@Entity public class WealthyPerson extends Person { @ElementCollection @CollectionTable(name="HOMES") // use default join column name Not B: No such thing as @ElementTable in Java. not C: SecondaryTablespecifies a secondary table for the annotated entity class. Specifying one or more secondary tables indicates that the data for the entity class is stored across multiple
Topics
Community Discussion
No community discussion yet for this question.