📒 [실전! 스프링 데이터 JPA - 김영한]
📒 [Spring Docs]
@Query 어노테이션을 통해 작성된 쿼리 중 데이터 조작 언어(Data Manipulation Language)인 UPDATE, INSERT, DELETE 가 포함된 쿼리 메서드에 사용합니다.executeUpdate() 메서드가 적용된 벌크 연산(여러 건의 데이터를 한 번에 조작하는 방법)이 사용될 때 사용합니다.public @interface Modifying {
/**
* Defines whether we should flush the underlying persistence context
* before executing the modifying query.
*
* @return
*/
boolean flushAutomatically() default false;
/**
* Defines whether we should clear the underlying persistence context
* after executing the modifying query.
*
* @return
*/
boolean clearAutomatically() default false;
}
clearAutomatically 속성의 기본값(default)은 false 이다.clear 하는지 여부를 정의합니다.clearAutomatically 속성을 true 로 설정하면 현재 영속성 컨텍스트의 모든 객체 정보에 대하여 clear 를 진행합니다.flushAutomatically 속성의 기본값(default)은 false 이다.flush 해야 하는지 여부를 정의합니다.flushAutomatically 의 속성을 true 로 설정하면 현재 영속성 컨텍스트의 모든 객체 정보에 대하여 flush 를 진행합니다.