JPA1 JPA Dirty Checking 과 Transaction Dirty Cheking이란? Transaction 안에서 엔티티의 변경이 일어날 경우 변경 내용을 자동을 데이터베이스에 반영하는 JPA 특징 JPA 에는 update는 존재하지 않는다. entity save를 진행할 경우 isNew메서드를 통해 entity가 새로운 Entity인지 존재하는 Entity인지 판단한다. 존재할 경우 merge를 진행 새로운 Entity라면 persist를 진행한다. @Transactional @Override public S save(S entity) { Assert.notNull(entity, "Entity must not be null."); if (entityInformation.isNew(entity)) { em.persist(entity); return entit.. 2023. 5. 30. 이전 1 다음