The developer has defined the following entity class office:
Which of the following attributes will be in corresponding generated static metamodel class for the rooms field?
A.
Public static volatile CollectionAttribute<Room> rooms;
B.
Public static volatile ListAttribute<Room> rooms;
C.
Public static volatile ListAttribute<Office, Room> rooms;
D.
Public static volatile SingleAttribute<Room> rooms;
C
c
C is correct http://www.developer.com/java/ent/article.php/3902911/Querying-in-JPA-2-Typesafe-and-Object-Oriented.htm
C
C
“C”
Answer : C
For every persistent collection-valued attribute z declared by class X, where the element type of z is Z, the metamodel class must contain a declaration as follows: if the collection type of z is java.util.List, then public static volatile ListAttribute z;
Answer : C
explanation:
• For every persistent non-collection-valued attribute y declared by class X,
where the type of y is Y, the metamodel class must contain a declaration as follows:
public static volatile SingularAttribute y;
• For every persistent collection-valued attribute z declared by class X, where the element type of z is Z, the metamodel class must contain a declaration as follows:
• if the collection type of z is java.util.Collection, then
public static volatile CollectionAttribute z;
• if the collection type of z is java.util.Set, then
public static volatile SetAttribute z;
• if the collection type of z is java.util.List, then
public static volatile ListAttribute z;
• if the collection type of z is java.util.Map, then
public static volatile MapAttribute z;
where K is the type of the key of the map in class X