Здравствуйте! Надеюсь вы сможете мне помочь!
В общем есть две сущности
AuthorEntity.class
@Entity(name = "Author")
@Table(name = "authors")
@NoArgsConstructor
@Getter
@Setter
@ToString
public class AuthorEntity extends AbstractEntity implements Serializable {
@Column(name = "name", nullable = false)
private String name;
@Column(name = "surname")
private String surname;
@Column(name = "patronymic")
private String patronymic;
@Column(name = "birthday")
private Date birthday;
@ManyToMany(mappedBy = "authors", targetEntity = BookEntity.class)
@ToString.Exclude
private Set<BookEntity> writtenBookList;
}
BookEntity.class
@Entity(name = "Book")
@Table(name = "books")
@NoArgsConstructor
@Getter
@Setter
@ToString
public class BookEntity extends AbstractEntity implements Serializable {
@NaturalId
@Column(name = "title")
private String title;
@Column(name = "number_of_page")
private Integer numberOfPage;
@Column(name = "release_date")
private Date releaseDate;
@Column(name = "price")
private BigDecimal price;
@ManyToMany(mappedBy = "writtenBookList", targetEntity = AuthorEntity.class)
@ToString.Exclude
private Set<AuthorEntity> authors;
@ManyToOne(targetEntity = PublisherEntity.class, optional = false)
@ToString.Exclude
private PublisherEntity publisher;
но вот выходит ошибка с foreign key
ошибка с полезной инфой
Error executing DDL "alter table books_authors drop foreign key FK4ubf8cww2y8a1fj78qmkjlo74" via JDBC Statement
...
Caused by: java.sql.SQLSyntaxErrorException: Table 'e_halyk_shop.books_authors' doesn't exist
...