作者等级:
@Id
@GeneratedValue(
strategy = GenerationType.AUTO)
private int id;
private String firstName;
private String lastName;
@OneToMany(
mappedBy = "author")
private List<Book> bookList;
书类:
@Id
@GeneratedValue(
strategy = GenerationType.AUTO)
private int id;
private String name;
private String language;
private int isbn;
@ManyToOne
@JoinColumn(
name = "author_fk")
private Author author;
我想删除作者,但出现以下错误:“更新或删除表“作者”违反了表“书”上的外键约束“fk_book_author_fk””。如何删除作者?我想先删除作者,而不是书。