Search your topic in Java2share
Home > SCBCD > SCBCD Question Bank
eXTReMe Tracker

5. Java Persistence API Entities (SCBCD)

Q: 1 Given:
11. @Entity public class X {
12. @Id int id;
13. Y y;
14. }
A public class Y with NO Java Persistence annotations is defined in the same package.
Which statement is correct about these classes if NO other annotations and mapping descriptors are provided?

A. Class Y must be serializable.
B. Class Y must be marked as an entity.
C. The entity X is not defined correctly.The field y must be marked as @Lob.
D. Class Y must be accessed by a persistence application through a public interface.

Answer: A

Q: 2 Which two class types must be implicitly or explicitly denoted in the
persistence.xml descriptor as managed persistence classes to be included within a persistence unit?

(Choose two.)
A. Entity classes
B. Interceptor classes
C. Embedded classes
D. Entity listener classes

Answer: A, C

Q: 3 Which statement about the combination of mapping defaults, annotations, and
XML descriptors is correct?

A. All mapping annotations must always be processed by the persistence provider.
B. Some annotations, like the @Entity annotation, must always be processed by the persistence provider.
C. The mapping information for an entity class specified by annotations and in XML descriptors must be
D. If multiple entity listeners are defined, the order in which they are invoked can be defined or overwritten in
the XML descriptor.

Answer: D

Q: 4 Which statement about an entity instance lifecycle is correct?
A. A new entity instance is an instance with a fully populated state.
B. A detached entity instance is an instance with no persistent identity.
C. A removed entity instance is NOT associated with a persistence context.
D. A managed entity instance is the instance associated with a persistence context.

Answer: D