I am trying to create a simple SpringDataJPA application. I am using H2 database. After annotating the model class with @entity annotation the table is successfully created in H2 DB and the same can be viewed through the h2-console. however to initialise the table i am trying to insert the values from data.sql but while starting the application the error indicates that the table is not being found . Why is the table not being found when I am able to view the ?
Asked
Active
Viewed 1,617 times
1
-
please dont post links - post actual code. Anyways this might answer your question: https://stackoverflow.com/questions/67678311/spring-boot-is-not-creating-tables-automatically – J Asgarov May 26 '21 at 12:48
1 Answers
5
Spring Boot 2.5.0 changed the way schema.sql and data.sql are handled.
You have to set
spring.jpa.defer-datasource-initialization=true
to make your example work.

Simon Martinelli
- 34,053
- 5
- 48
- 82
-
Thanks a lot Simon !!!! :) I made the changes as suggested and it did work!!! Yayyyyy – maveric123 May 27 '21 at 04:05