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

456
Vistas
Hibernate: Always update a given record even if its not dirty

My requirement is to update a table's record even though the record is not dirty. Hibernate is by default ignoring update query if all the columns that are passed are same. But I do not want that. Reason being, we have some triggers written on the database insert/update/delete, which needs to know if anyone trying to update any record. This is very critical element of the application and want it in this way.

I am browsing a lot on this, but finding about @DynamicUpdate, but what I want is the reverse of it.

Any help would be really helpful.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

If you have a version attribute i.e. annotated with @Version you could use OPTIMISTIC_FORCE_INCREMENT for loading the entity which will always cause a write that increments the version: https://docs.oracle.com/javaee/7/api/javax/persistence/LockModeType.html#OPTIMISTIC_FORCE_INCREMENT

over 4 years ago · Santiago Trujillo Denunciar

0

You need to use something like session.flush() after each update to force consequent updates perform "real" saving of an entity within same session/transaction. Can't advice more since you haven't provide any code sample.

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