에러 기록

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table notice drop foreign key

leeeehhjj 2021. 7. 28. 16:54

스프링부트로 프로젝트를 하는 과정에서 

테이블끼리 조인하기 위해 @ManyToOne 어노테이션을 사용했는데

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table notice drop foreign key ~

이런 오류가 발생했다.

 

동시에

org.h2.jdbc.JdbcSQLException: Table "NOTICE" not found; SQL statement:

오류도 함께 발생했다.

 

이를 해결하기 위한 방법은

spring.jpa.show_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect
spring.jpa.properties.hibernate.dialect.storage_engine=innodb
spring.datasource.hikari.jdbc-url=jdbc:h2:mem:testdb;MODE=MYSQL;
spring.datasource.hikari.username=sa
spring.h2.console.enabled = true
spring.jpa.hibernate.ddl-auto = update

이처럼 spring.jpa.hibernate.ddl-auto = update으로 바꿔주는 것이다.