Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

331
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda