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

274
Vistas
How to force TypeORM to update an entity using repository.save() even if there are no changes

I have introduced certain decorators to the fields in my entity class that get triggered when an entity is saved using repository.save()

I am using entitySubscriber interface to check for events (Reference) and calling certain methods to perform an operation like this:

public beforeUpdate({ entity }: UpdateEvent<any>): void {
     encryptData(entity);
  }

But I noticed that this method is only called when we actually update certain fields in the entity. Is there a way to override this behaviour so that this method is called or in other words @BeforeUpdate hook is triggered every time we do a repository.save() ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Nope unless you modify the TypeORM sourcecode.

about 4 years ago · Juan Pablo Isaza 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