SpringBoot3.0 Entity생성오류
Error creating bean with name 'entityManagerFactory' defined in class path resource
Could not determine recommended JdbcType for `com.sbb.question.domain.Question`
entityManagerFactory를 초기화 하지 못했다
-> `com.sbb.question.domain.Question` 에 권장되는 jdbcType을 결정할 수 없다
위와 같은 에러가 발생하는 이유로 여러가지 이유가 있는 존재합니다.(Entity생성 오류로 추정)
보통 연관관계 설정을 잘못해서 발생하는 것 같은데 저는
@GeneratedValue를 auto로 놔둬서 오류가 놨던것 같습니다.
-> mariaDB에서는 오류메시지는 출력되지만 서버는 죽지않음
-> h2DB에서는 위와 같은 에러와 함께 종료
해결방법 - 매핑전략 바꾸기!(Auto 웬만하면 사용X)
@GeneratedValue(strategy = GenerationType.IDENTITY)
JPA 기본키 생성 전략, @GeneratedValue 사용시 주의점 (tistory.com)
JPA 기본키 생성 전략, @GeneratedValue 사용시 주의점
JPA로 테이블과 엔티티를 매핑할 때, 식별자로 사용할 필드 위에 @Id 어노테이션을 붙여 테이블의 Primary Key와 연결 시켜줘야한다. 이 때, 컬럼 명을 따로 지정하지 않으면, 관례에 따라 매핑되는
devcamus.tistory.com
[JPA] 기본 키(Primary Key)매핑 - @Id, @GeneratedValue (tistory.com)
[JPA] 기본 키(Primary Key)매핑 - @Id, @GeneratedValue
🧐 @Id 데이터베이스 테이블의 기본 키(PK)와 객체의 필드를 매핑시켜주는 어노테이션입니다. 적용 가능 타입 자바 기본형 (int, long, ...) 자바 래퍼형 (Integer, Long, ...) String Date (java.util) Date (java.sql)
ttl-blog.tistory.com
[JPA] H2의 @GeneratedValue 문제 :: Hyeonic's Blog (tistory.com)
[JPA] H2의 @GeneratedValue 문제
개요 프로젝트를 진행하던 도중 아직 User 관련된 기능들이 완성되지 않아서 DB에 초기값을 insert하기 위해 웹 서버를 실행하는 시점에 값을 insert 하기로 결정하였다. 필요한 파일과 설정 준비 우
hyeonic.tistory.com