简体   繁体   中英

Hibernate generates invalid DDL (PostgreSQL 9.6)

I'm using Spring Boot JPA with no dialect configured in application.properties. In my output, I can see that Hibernate is generating the following DDL commands:

create table user 
(
   id int8 not null, 
   password varchar(255), 
   username varchar(255), 
   primary key (id)
)

Which leads to a syntax error, because the table name must be enclosed within quotation marks.

That's my 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

You can use the table name in quotes.
Here is one of the fine example which I have solved. The answer contains everything that you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM