【发布时间】:2021-09-15 05:33:57
【问题描述】:
我的application.properties 文件中有这段代码:
# Spring DataSource
spring.datasource.driverClassName=org.postgresql.Driver
spring.sql.init.mode=always
spring.sql.init.platform=postgres
spring.datasource.url=jdbc:postgresql://localhost:5432/dbname
spring.datasource.username=postgres
spring.datasource.password=root
# JPA-Hibernate
spring.jpa.generate-ddl=true
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=create
# https://stackoverflow.com/questions/43905119/postgres-error-method-org-postgresql-jdbc-pgconnection-createclob-is-not-imple
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
# Optimization for POSTGRES queries
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
如您所见,我添加了 spring.jpa.hibernate.ddl-auto=create 行,但 JPA 仍未创建表。我必须手动创建它们才能编译项目。怎么了?
【问题讨论】:
标签: java postgresql spring-boot hibernate jpa