[에러] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource

손경이·2024년 1월 24일
0

에러모음

목록 보기
15/20

2024.01.24
[테킷 백엔드] 전자책 강의
환경 - 스프링부트 3.2.1, 자바 JDK21

❗ 에러 문구

  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Could not determine recommended JdbcType for Java type 'com.ll.mb.domain.member.member.entity.Member'

📸 에러 캡쳐


🔎 에러 이유 및 해결

  • 에러가 발생한 이유

    • @ManyToOne 어노테이션이 Member 필드에 존재하지 않으면, JPA는 이 필드를 양방향 연관 관계의 주인으로 인식하지 않게 되고, 이로 인해 연관 관계를 올바르게 매핑할 수 없어서 에러가 발생
  • 해결한 이유

    • @ManyToOne 어노테이션은 연관 관계를 나타내는데 사용
    • JPA는 Product 엔티티가 Member 엔티티와 다대일(Many-to-One) 양방향 연관 관계를 가진다는 것을 인식
    • 연관 관계를 명확하게 정의하는 것은 JPA에서 엔티티 간의 관계를 올바르게 매핑하는 데 필요
  • 해결한 코드

0개의 댓글