JPA bulk operations, such as DELETE
or UPDATE
, are issued as SQL against the database. So, the persistence context is not updated to reflect the results of the operation.
For example, updating the department of all employees, the entities managed in persistence context will not have their values updated:
entityManager.createQuery("UPDATE Employee e SET e.department = null").executeUpdate();
How to make the persistence context recognize the changes made by the bulk operation?
Aucun commentaire:
Enregistrer un commentaire