Which statement is correct?

A developer wants to create a portable EJB 3.0 application that includes the following class
definition for the Entity Account:

11. @Entity
12. @EntityListeners(com.acme.AlertMonitor.class)
13. public class Account {
14. //more code here
15. @PrePersist
16. protected void validateCreate() {/* more code here */}
17. }
Which statement is correct?

A developer wants to create a portable EJB 3.0 application that includes the following class
definition for the Entity Account:

11. @Entity
12. @EntityListeners(com.acme.AlertMonitor.class)
13. public class Account {
14. //more code here
15. @PrePersist
16. protected void validateCreate() {/* more code here */}
17. }
Which statement is correct?

A.
The validateCreate method may NOT throw runtime exceptions.

B.
The validateCreate method can invoke the EntityManager.flush operation.

C.
Methods of the class com.acme.AlertMonitor annotated with callback annotations must take an
Object or Account instance as the only argument.

D.
The above class definition is NOT correct. An entity cannot define a callback method like
PrePersist and use the EntityListeners annotation at the same time.



Leave a Reply 0

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