0
我正在使用Spring Boot JPA,沒有在application.properties中配置dialect。 在我的輸出,我可以看到,Hibernate是爲了生成以下DDL命令:Hibernate生成無效DDL(PostgreSQL 9.6)
create table user
(
id int8 not null,
password varchar(255),
username varchar(255),
primary key (id)
)
導致一個語法錯誤,因爲表的名稱必須用引號括起來。
這是我的application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/springtest
spring.datasource.username=...
spring.datasource.password=...
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true
'user'是保留字(關鍵字)嘗試其他名稱(或引用它'CREATE TABLE「用戶」...') – wildplasser
不要使用需要引用的名稱,即使您可以說服您的模糊處理層這樣做。使用保留關鍵字作爲標識符時,您會遇到更多問題 –
*迷惑層*確實是正確的術語。例如:你多久看一次語法錯誤?只是不要相信它。不要依賴它。這是等待發生的破損。 IMnsHO – wildplasser