Exam 1z0-900 All QuestionsBrowse all questions from this exam
Question 21

Given the code fragment:

How can you apply DateConverter to the birthday field?

    Correct Answer: C

    To apply the DataConverter to the birthday field, the correct method is by adding @Converter(autoApply=true) at line 1. This ensures that the custom converter is automatically applied to all attributes of the specified type within the persistence unit. Other options are incorrect as they either specify incorrect syntax or do not provide the mechanism for consistent automatic conversion across the entity.

Discussion
IraOption: C

I think the answer is C. based on example 2 in the link: https://docs.oracle.com/javaee/7/api/javax/persistence/Convert.html

orjavaOption: C

Answer C

ciellaf5Option: D

It must be @Convert(converter=DateCoverter.class)