본문 바로가기

JPA

Entity의 null값으로 인해 default 설정 반영이 안될 때

728x90
반응형
SMALL

기본적으로 hibernate는 insert 와 update 시 모든 컬럼 을 사용함.

 

 

 

@DynamicInsert

-> Insert 구문 생성 시점에 null이 아닌 칼럼들만 포함시킴.

 

@DynamicUpdate

-> Update 구문 생성 시점에 null이 아닌 칼럼만 포함시킴. 

 

@DynamicInsert
@DynamicUpdate
@Entity
public class Member {
  //...
}

 

 

 

 

 

728x90
반응형
LIST

'JPA' 카테고리의 다른 글

Insert Query 줄이기(성능개선)  (0) 2023.04.10
N+1 문제  (0) 2023.03.16
JPQL 사용 시 DTO Mapping 하는 법  (1) 2023.02.24
Spring data jpa 란?  (3) 2022.04.08
JPA 란? 영속성 컨텍스트란?  (0) 2022.04.08