Entity lifecycle callback methods may be defined in which three classes? (Choose three)

Entity lifecycle callback methods may be defined in which three classes? (Choose three)

Entity lifecycle callback methods may be defined in which three classes? (Choose three)

A.
Embedded classes

B.
Entity classes

C.
Abstract classes

D.
Entity listener classes

E.
Mapped superclasses

F.
Concrete non-entity superclasses

Explanation:
http://stackoverflow.com/questions/3747268/how-to-inject-a-springs-service-bean-into-a-jpa-entity(See the answer, first paragraph)



Leave a Reply 8

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


Mohamed Fayek

Mohamed Fayek

Correct answer

A lifecycle callback method may be defined on an entity class, a mapped superclass, or an entity listener class associated with an entity or mapped superclass

Mohamed Fayek

Mohamed Fayek

some rules for callback methods :
1.Callback methods defined on an entity listener class have the following signature:

void (Object)

The callback methods can have public, private, protected, or package level access, but must not be static or final.

2. At the most one method for one lifecycle event can exist in a class.

Mohamed Fayek

Mohamed Fayek

The following rules apply to lifecycle callbacks:

1. Lifecycle callback methods may throw unchecked/runtime exceptions. A runtime exception thrown by a callback method that executes within a transaction causes that transaction to be marked for rollback.

2. Lifecycle callbacks can invoke JNDI, JDBC, JMS, and enterprise beans.

3. In general, the lifecycle method of a portable application should not invoke EntityManager or Query operations, access other entity instances, or modify relationships within the same persistence context. A lifecycle callback method may modify the non-relationship state of the entity on which it is invoked.

Erkin

Erkin

BCD

Erkin

Erkin

Sorry, the answer is correct.

Carina

Carina

nfl shop outlet nhl shop cyber monday discount code black friday nhl shop coupon code

Tommy_Croatia_Zgb

Tommy_Croatia_Zgb

JPA 2.0 specification:

3.5.1 Lifecycle Callback Methods

Entity lifecycle callback methods can be defined on an entity listener class and/or directly on an entity class or mapped superclass.