Which option will achieve this behavior?

Your application uses the Java Persistence API to access a database. This application must reject
adding an instance to the database if it does NOT pass validation tests for values of two
persistence properties. The database contains some data that will NOT pass such validation. Only
the new records must be validated. Which option will achieve this behavior?

Your application uses the Java Persistence API to access a database. This application must reject
adding an instance to the database if it does NOT pass validation tests for values of two
persistence properties. The database contains some data that will NOT pass such validation. Only
the new records must be validated. Which option will achieve this behavior?

A.
Add validation logic to the setter methods for each property.

B.
Add the PrePersist callback method with all of the validation logic.

C.
Add the PostPersist callback method with all of the validation logic.

D.
Add PrePersist and PreUpdate callback methods with all of the validation logic.



Leave a Reply 0

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