2023.02.23 TIL

듀듀·2023년 2월 22일
1
post-thumbnail

JPA를 통한 Entity 생성 시 필드값에 Double 타입이 존재할 때

JPA를 통한 Entity 생성 시 필드값Double 타입이 존재한다면 JPADouble 타입을 인식하지 못하는 경우가 생긴다.
이 때 해결 방법은!

@Entity
public class User{

	@Column(columnDefinition = "float8") //float8 으로 설정 또는
    private Double height;
    
    @Column(columnDefinition = "double precision") //double precision 으로 설정
    private Double weight;
    
}

double 타입의 columnDefinition 값을 float 또는double precision으로 설정해주면 해결할 수 있다.

profile
나는 내 의지대로 된다.

0개의 댓글