Reputation: 1354
I have tried to follow this guide to store my data in the h2 database with Spring Boot. https://memorynotfound.com/spring-boot-spring-data-jpa-hibernate-h2-web-console
But it looks like the DB tables aren't created. It also doesn't get an error message, so I don't know what I'm doing wrong.
I tried to add @EntityScan
, but it's not working.
*Update
spring.h2.console.enabled=true
spring.h2.console.path=/console
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false
spring.datasource.url=jdbc:h2:mem:example-app;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.platform=h2
spring.datasource.username = sa
spring.datasource.password =
spring.datasource.driverClassName = org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.use_sql_comments=false
spring.jpa.properties.hibernate.format_sql=false
Upvotes: 1
Views: 3750
Reputation: 360
Make sure that You have this config property (it is automatically like that for h2 though):
spring:
jpa:
hibernate:
ddl-auto: update
Upvotes: 3