Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

323
Views
Can I apply @Enumerated(EnumType.STRING) once globally instead of on each enum?

I want all enums in my classes persisted by JPA as Strings, not ordinal. Can I declare that globally someplace? I'm using Spring Data JPA + Hibernate + postgresql.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer is no.

Enum parameters are a compile time constants - there is no avenue to change them at runtime, and there's no way to craft a "project default".

Oddly, the only sane choice is STRING, mostly because ORDINAL is brittle; the order of your enums is forever locked in (data surgery notwithstanding), so I can't understand why the default is ORDINAL - I have never heard of any project using the it.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!