Free 1Z0-898 Braindumps

to simplify the code.
Which two mapping options can be chosen? (Choose two.)

A. Use an @id property that constructs a private field as a concatenation of two columns.
B. Use a separate class to map those two columns and use an @idclass annotation to denote I
primary key field or property in the entity.
C. Use a separate @Embeddable class to map those two columns and use an @EmbeddedId
annotation to denote a single primary key field or property in the entity.
D. Use a separate @Embeddable class to map those two column and add two fields or
properties the entity, each marked as @id, that correspond to the fields or properties in the
embeddable class.
E. Use a separate class to map those two columns. Specify that class using @Idclass
annotation on the entity class. Add two fields or properties to the entity, each marked as @Id,
that correspond to the fields or properties in that separate class.

Answer(s): C, E
Explanation:
C:Annotation Type EmbeddedId
Applied to a persistent field or property of an entity class or mapped superclass to denote a
composite primary key that is an embeddable class. The embeddable class must be annotated
as Embeddable.
E:Annotation Type IdClass
Specifies a composite primary key class that is mapped to multiple fields or properties of the
entity.The names of the fields or properties in the primary key class and the primary key fields or
properties of the entity must correspond and their types must be the same.
Example:
@IdClass(com.acme.EmployeePK.class)
@Entity
public class Employee {
@Id String empName;
@Id Date birthDay;
}
Reference:
javax.persistence, Annotation Type EmbeddedId
javax.persistence , Annotation Type IdClass
QUESTION: 7
A developer wants to model the grades for a student as a Map<course, integer>. Assume that
Student and Course are entitles, and that grades are modeled by integers.
Which of the following two statements are correct? (Choose two)

A. The developer can model the grades as an element collection in the Student entity.
B. The developer can model the grades as a oneToMany relationship in the Student entity.
C. The mapping for the key of the map can be specified by the @MapKeycolumn annotation.
D. The mapping for the value of the map can be specified by the @Column annotation.

Answer(s): A, D
Explanation:
A:JPA 2.0 defines an ElementCollection mapping. It is meant to handle several non- standard
relationship mappings. An ElementCollection can be used to define a one-to-many relationship

Get The Premium Version

Allbraindumps.com
 Test Questions PDF from Myitguides.com

 Test Questions PDF from Myitguides.com