I want to make a relation one to many with the same class java using hibernate (spring data)
this is my code
@Data
@Entity
public class TemplateData implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private TemplateData div;
@OneToMany(mappedBy="div")
private Collection<TemplateData> baseCSS;
private int position;
private String data;
}
and I get this error
HHH000388: Unsuccessful: alter table add constraint template data FK_y1mi9blsbc08tmwm9jgvdd1b foreign key (template_data_id) references template_data
ERROR: "template_data" relationship does not exist