작성
·
5.4K
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에 빨간줄 그어진거랑은 상관없이 테이블이 만들어지지않는거같은데
어디서 에러가나는건지 잘모르겠어요 ..ㅜ
답변 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
0
안녕하세요. 혀켱님
오류 메시지를 보면 다음에 중요한 힌트가 있습니다.
mappedBy reference an unknown target entity property: jpabook.jpashop.domain.Category.items in jpabook.jpashop.domain.item.Item.categories
Category에서 items 멤버 변수에 설정한 부분과 Item의 categories를 설정한 부분을 예제 코드와 같은지 체크해주세요^^
감사합니다.