The problem of updating entity classes with Update Query in Spring Data JPA
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)