Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda