내가 사용하려고 스프린트 부팅 ManyToOne 주석이다. 내 코드는 다음과 같이 Order
클래스
package com.example.demo_app.data.models;
import javax.persistence.*;
@Entity
public class Order extends Object {
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "person_id")
private Person person;
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
}
고 Person
클래스는 다음과 같이
package com.example.demo_app.data.models;
import javax.persistence.*;
import java.util.List;
@Entity
public class Person {
private Long id;
@OneToMany(targetEntity = Order.class)
private List<Order> orders;
public void setId(Long id) {
this.id = id;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public List<Order> getOrders() {
return orders;
}
public void setOrders(List<Order> orders) {
this.orders = orders;
}
}
이는 오류동
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.List, at table: person, for columns: [org.hibernate.mapping.Column(orders)]
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: person, for columns: [org.hibernate.mapping.Column(orders)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:512)
어떤 도움에 감사드립니다. 감사합니다!