Author class:
@Id
@GeneratedValue(
strategy = GenerationType.AUTO)
private int id;
private String firstName;
private String lastName;
@OneToMany(
mappedBy = "author")
private List<Book> bookList;
Book class:
@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;
I want to delete author and i am getting following error: "update or delete on table "author" violates foreign key constraint "fk_book_author_fk" on table "book"". How can I delete author ? I want to delete author first, not book.