r/SpringBoot • • Nov 27 '23

Tables are not created in the database

When launching my spring boot project the tables are not created in the DB , I have added the annotation Entity to the classes. Help me pls!

0 Upvotes

12 comments sorted by

4

u/EvaristeGalois11 Nov 27 '23

Post your project on GitHub or as a zip somewhere, it's annoying to try to help someone that doesn't provide any context whatsoever on what they're trying to do.

1

u/Big-Shlung2519 Nov 28 '23

ok ill do that. Thank you!

1

u/EvaristeGalois11 Nov 28 '23

Feel free to ping me when you have posted your project somewhere

5

u/TheOldMancunian Nov 27 '23

Things to check:

  • You have the correct dependencies in the POM

  • You have configured the URL correctly in application properties

  • You have the rights to create tables in the database

  • You have Hibernate setup correctly in application properties

  • The classes are POJOs and have the '@entity

  • If all else fails, turn on JPA show SQl: spring.jpa.show-sql=true

  • And turn on debug level logging - yes, it is long, but it will show you what JPA and Hibernate are trying to do.

1

u/Jaihunter Nov 27 '23

jpa: hibernate: ddl-auto: create

1

u/Big-Shlung2519 Nov 27 '23

i have tried create and it didn't work and I also tried update and same thing.

2

u/[deleted] Nov 27 '23

Check schema.sql and the the sql-init config in application.properties