Je suis en train d'utiliser Sprint de démarrage ManyToOne annotation sur un champ. Mon code ressemble à ça pour l' Order
classe
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;
}
}
Et la Person
classe ressemble à ceci
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;
}
}
C'est l'erreur que j'obtiens
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)
Toute aide est appréciée. Merci!