Select the item below that accomplishes this task:

The developer has modeled student interests as a set <String>:

@Entity public class Student {
@Id int student Id;
string name;
@ElementaryCollection
Set <String> Interests;
. . .
}

The developer wants the values of this set to be stored using a column named student_intersets.
Select the item below that accomplishes this task:

The developer has modeled student interests as a set <String>:

@Entity public class Student {
@Id int student Id;
string name;
@ElementaryCollection
Set <String> Interests;
. . .
}

The developer wants the values of this set to be stored using a column named student_intersets.
Select the item below that accomplishes this task:

A.
@ElementaryCollection
@Column(name = �student_interests�)
Set <string> interests;

B.
@ElementaryCollection (column = �student_intersets�) Set<String> interests;

C.
@ElementaryCollection @CollectionTable (column = �student_intersets�) Set<String> interests;

D.
@ElementaryCollection @CollectionTable (column = @column(name = �student_interests�))
Set <String> interests;

Explanation:
http://en.wikibooks.org/wiki/Java_Persistence/ElementCollection(see Example of a
elementcollection relationship to a basic value annotations)



Leave a Reply 5

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


Marian

Marian

A is correct

test

test

Tested,
A is the correct answer

test

test

This answer overrides the table name not the column name

Mohamed Fayek

Mohamed Fayek

EMPLOYEE (table)
EMP_ID F_NAME L_NAME SALARY
1 Bob Way 50000
2 Joe Smith 35000

PHONE (table)
OWNER_ID PHONE_NUMBER
1 613-792-0001
1 613-494-1234
2 416-892-0005

Example of a ElementCollection relationship to a basic value annotations[edit]

@Entity
public class Employee {
@Id
@Column(name=”EMP_ID”)
private long id;

@ElementCollection
@CollectionTable(
name=”PHONE”,
joinColumns=@JoinColumn(name=”OWNER_ID”)
)
@Column(name=”PHONE_NUMBER”)
private List phones;