nerdexam
Oracle

1Z0-898 · Question #50

The developer is creating a Java Persistence model for a legacy database. The database contains customer and subscriptions. The subscriptions table has a foreign key to the Customer table, a foreign…

The correct answer is E. @ElementaryCollection. The ElementCollection values are always stored in a separate table. The table is defined through the @CollectionTable annotation or the <collection-table> element. Annotation Type Temporal This annotation must be specified for persistent fields or properties of type…

Entity Relationships

Question

The developer is creating a Java Persistence model for a legacy database. The database contains customer and subscriptions. The subscriptions table has a foreign key to the Customer table, a foreign key to the magazines table, and a column that stores a java.util.Date (the subscription expiration date). The developer wants to create entities Customer and subscription to model these tables and to represent the relationship between customer and subscription as a java.util.Map. Which one of the following fields of the Customer entity accomplishes this task?

Options

  • A@OneToMany
  • B@ElementaryCollection
  • C@OneToMany
  • D@ElementaryCollection
  • E@ElementaryCollection

How the community answered

(43 responses)
  • A
    7% (3)
  • B
    9% (4)
  • C
    2% (1)
  • D
    2% (1)
  • E
    79% (34)

Explanation

*The ElementCollection values are always stored in a separate table. The table is defined through the @CollectionTable annotation or the <collection-table> element. *Annotation Type Temporal This annotation must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.

Topics

#OneToMany#Map relationship#MapKey#collection mapping

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice