JPA: Persistence Context And Dirty Check Mechanism
Few entities were being persisted to database in certain cases, without explicitly calling save() or without having @Transactional annotation. Digging a little deeper, I realised this behaviour is due to persistence context and dirty check mechanism. Persistence Context Observation 1: Two entities, user and account, are retrieved from database and fields of both entities are modified. When save() was called only on account entity, both the entities were being persisted to database....