Hibernate Foreign Key Issue:Error Executing Ddl "Alter Table..."

How to fix Error executing DDL alter table events drop foreign key FKg0mkvgsqn8584qoql6a2rxheq via JDBC Statement

In my case the problem why i got this exception was, that some tables had names which are reserved for postgreSQL. eg. "Like" or "User". Changed name with:

@Table(name="likes") 

and it worked fine.
Perhaps someone has the same problem.

Error executing DDL alter table if exists task.city

Hmm, try

public class House {
...
@ManyToOne(optional = false)
@JoinColumn(name = "city_id", referencedColumnName = "id")
private Set<City> city;
...
}

btw,

  • should not use @Data lombok in an entity class
  • spring.jpa.hibernate.ddl-auto=update can change update to none. You should manage schema on your own.

Error executing DDL alter table add constraint foreign key () references (id) via JDBC Statement

I noticed in db, duplicates tables were being created so that's why i was getting that error

Adding below annotation solved my problem :

@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)


Related Topics



Leave a reply



Submit