Consider a persistence application with following entity:
@Entity
Public class MyEntity {
@Column (name = FIELDA_COLUMN)
int fieldA;
int fieldB;
int fieldC;
int fieldD;
An orm.xml is packaged in the application with the following contents:
Which two of following statement are true. (Choose two)
A.
fieldA is mapped to column FIELDA
B.
fieldB is mapped to column NEW_COLB
C.
fieldD is a persistent attribute of MyEntity
D.
fieldD is not a persistence attribute of MyEntity
B C
B C
B,C
B C
Correct answers are B and C.
B: Mapping information in orm.xml overrides the mapping information given in annotations.
C: Since there is no mapping information specified either through @Column annotation or through orm.xml, the default will be used, which is same as the field name (fieldD will be mapped to column named fieldD). A field will not be considered persistent only if it is marked @Transient (or specified so in orm.xml).