While running spring boot with h2 database and JPA i am getting below error.
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table departement drop foreign key FKixq3xt09hgnls2vfidrwbs98n" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:387) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
It is caused due to below one
Caused by: java.sql.SQLSyntaxErrorException: Table 'springdb.departement' doesn't exist
my classes are departement and university
this is the department class.
@Entity
@Table(name = "Departement")
public class Departement {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idDepart;
private String nomDepart;
public int getIdDepart() {
return idDepart;
}
@ManyToOne
@JoinColumn(name = "idUniv", nullable = false)
private Universite universite;
and this is the university class.
@Entity
@Table(name = "Universite")
public class Universite {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idUniv;
private String nomUniv;
@OneToMany(mappedBy = "universite")
private Set<Departement> departements;
Any help.
I tried to delete the base and re try again and again.
change this in application.properties : spring.jpa.hibernate.ddl-auto=update