exam questions

Exam 1z0-898 All Questions

View all questions & answers for the 1z0-898 exam

Exam 1z0-898 topic 1 question 23 discussion

Actual exam question from Oracle's 1z0-898
Question #: 23
Topic #: 1
[All 1z0-898 Questions]

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?

  • A. @OneToMany @joinColumn (name = "Customer - FK") Map <Magzine, Data> subscriptions;
  • B. @ElementCollection Map <Magzine, Data> subscriptions
  • C. @OneToMany @JoinTable (name = "Subscriptions") Map <Magzine, Data> subscriptions;
  • D. @ElementCollection @CollectionTable (name = "subscriptions") Map <Magazine, Data> subscriptions
  • E. @ElementCollection @CollectionTable (Name = "Subscriptions") @Temporal (TemporalType.DATE)
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️
* 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.
Reference: javax.persistence, Annotation Type Temporal

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...