Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The problem of updating entity classes with Update Query in Spring Data JPA

Shulou Source: shulou.com Published: 2022-06-03 07:15:44 09月23日 Update

Although the transaction can be updated using @ Modifying in jpa, the entity that executes the query after the modify statement is still not updated when the update is looped.

After executing the modifying query, the EntityManager may contain obsolete data because EntityManager does not automatically clean up entities.

EntityManager clears entity objects automatically only if you add the clearAutomatically attribute.

@ Modifying (clearAutomatically = true)

Tags: Entity update obsolete transaction only object attribute data time statement loop query problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology NVidia Linux Redmi Apple