I want to create a one to many relationship using Spring Boot and Hibernate
@Entity
@Table(name = "Cluster")
public class Cluster{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String project;
@OneToMany(mappedBy = "testclusters", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private Set<Record> records;
My second entity is:
@Entity
@Table(name="Record")
public class Record{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String summary;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id")
private Cluster cluster;
So I want to save the id of the cluster to the record table.
But I keep getting the error: Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.example.clusters.Model.Record.Cluster in com.example.clusters.Model.Cluster.record