Issue
Currently I have to add @Enumerated(EnumType.STRING)
to all fields that use enums, and very often I forget to do it, and then the default kicks in (EnumType.ORDINAL)
.
Is it possible to configure JPA to map all enums to String? (To make the default EnumType.STRING ?)
Solution
Unfortunately not.
But think twice when using enums. I wrote an article about the issues:
https://martinelli.ch/should-you-use-enums-with-jpa/
Answered By - Simon Martinelli
Answer Checked By - David Marino (JavaFixing Volunteer)