Which code fragment correctly defines such field?

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?

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?

A.
@ElementCollection (name = �NAMES�)
Protected set<String> otherUsedNames = new HashSet () ;

B.
@Element collection
@ElementTable (name = �NAMES�)
Protected set<String> otherUsedNames = new HashSet () ;

C.
@ElementCollection
@SecondaryTable (names = �NAMES�)
Protected set<String> otherUsedNames = new HashSet () ;

D.
@ElementCollection
@CollectionTable(names = �Names�)
Protected set<String> otherUsedNames = new HashSet () ;

Explanation:
http://docs.oracle.com/javaee/6/api/javax/persistence/CollectionTable.html



Leave a Reply 1

Your email address will not be published. Required fields are marked *