I have this code in my application.properties file:
# 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
As you can see I have the spring.jpa.hibernate.ddl-auto=create line added but the tables are still not being created by the JPA. I have to manually create them in order for the project to compile. What is wrong?
You can use spring.jpa.hibernate.ddl-auto=update and check you are using @Table(name="table_name") top on the entity class. It may help.
There are several possible causes:
Try adding @ComponentScan("package which contains entity classes, configurations and services")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With