inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

엔티티 클래스 개발2

테이블생성이안되는데 어디서 에러가난건지 못찾겠어요 ㅜ

5569

혀켱

작성한 질문수 8

1

안녕하세요 강사님

2021-02-10 11:48:17.131 ERROR 8876 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: mappedBy reference an unknown target entity property: jpabook.jpashop.domain.Category.items in jpabook.jpashop.domain.item.Item.categories

2021-02-10 11:48:17.132  WARN 8876 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: jpabook.jpashop.domain.Category.items in jpabook.jpashop.domain.item.Item.categories

2021-02-10 11:48:17.134  INFO 8876 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2021-02-10 11:48:17.149  INFO 8876 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

2021-02-10 11:48:17.155  INFO 8876 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

2021-02-10 11:48:17.171  INFO 8876 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-02-10 11:48:17.183 ERROR 8876 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

요렇게 나오고

기존에 만들었던 멤버클래스랑 멤버리파지토리클래스를 지워서 테스트에 MemberRepositoryTest에 빨간줄 그어진거랑은 상관없이 테이블이 만들어지지않는거같은데

어디서 에러가나는건지 잘모르겠어요 ..ㅜ

JPA 웹앱 spring-boot java spring

답변 4

0

김영한

Member의 다음 부분을 확인해주세요.

@Embedded
private Address address;

Address 부분도 확인해주세요.

package jpabook.jpashop.domain;

import lombok.Getter;

import javax.persistence.Embeddable;

@Embeddable
@Getter
public class Address {

private String city;
private String street;
private String zipcode;

protected Address() {
}

public Address(String city, String street, String zipcode) {
this.city = city;
this.street = street;
this.zipcode = zipcode;
}
}

0

혀켱

강사님 

하나만더 질문드릴게요

db생성목록중에 MEMBER테이블에 저는

city,street,zipcode는 생성이 안됐는데

강의랑 교제랑 비교해봐도 틀린건없는거같은데 

Member나 address클래스에 누락된건 없는거같은데 어디서 실수가있었던건지 궁금하네요..

0

혀켱

감사합니다.

여기서 items 에 s하나빠져서 나던에러였네요...

감사합니다

0

김영한

안녕하세요. 혀켱님

오류 메시지를 보면 다음에 중요한 힌트가 있습니다.

mappedBy reference an unknown target entity property: jpabook.jpashop.domain.Category.items in jpabook.jpashop.domain.item.Item.categories

Category에서 items 멤버 변수에 설정한 부분과 Item의 categories를 설정한 부분을 예제 코드와 같은지 체크해주세요^^

감사합니다.

sdk 설정 오류

0

44

2

오탈자 - @Transactional

0

53

1

src/test/resources 테스트 경로 문제

0

49

1

상품 등록후 H2 db 출력 순서 바꿀 수 있나요?

0

62

1

MemberRepositoryTest 실행오류

0

74

1

boot 4.x >>> trasasction rolled back log & p6spy(영한님, 수업 자료 업데이트 해주시면 감사하겠습니다!!)

1

182

2

강의 마지막 QueryDSL 사용 부분 질문있습니다

1

137

2

클라이언트에서 isbn과 author 수정 요청을 한 경우에 대해 질문드립니다.

0

50

1

도메인 모델 패턴 vs 트랜잭션 스크립트 패턴

0

71

1

기본 생성자

0

59

1

h2 DB 연결시 jdbc url 변경 이유가 궁금합니다.

0

100

1

멤버서비스테스트 부분에서 막힙니다.

0

163

4

실무에서도 EntityManager를 이용해서 많이 작업하는 편일까요?

0

115

1

초반에 h2 다운로드 과정 꼭 필요한가요?

0

117

2

자신 필드에도 get으로 접근하는 이유가 있을까요?

0

108

1

24분 27초 연관관계 편의 메서드 위치

0

112

1

단건 주문만 가능하게 한건 의도한 부분이신가요?

0

106

2

빌드 툴, Gradle

0

57

1

h2연결은 된 것 같은데 엔티티 테이블까지 작성 후 확인해보아도 테이블이 안보입니다

0

73

2

Repository에서 EntityManager 주입 방식 차이

0

87

1

롬복과 사용자 정의 setter 메서드

0

70

1

주문 목록 조회 fetch join 질문드립니다

0

80

1

dirty checking 질문드립니다.

0

79

1

동시성 관련 질문입니다

0

72

1