Home > Net >  Spring Boot clear cache manually
Spring Boot clear cache manually

Time:02-14

I was following some online lesson's playlist, test project for spring boot. Simplie CRUD stuff. It created some tables, but i decided to change some fields names, dropped table from cmd connected to mysql. After the relaunch the project does not create this table once more. Am i right, that it's stored somewhere in cache, the record that the table has been already created? Or, for example, does it store the autoincrement id's value somewhere in cache? After the second relaunch spring just does not check the existence of the table in database because of some log in cache? How can i fix it without starting the project from scratch?

CodePudding user response:

probably the spring.jpa.hibernate.ddl-auto is turn off or not set. try setting it to create-drop

here's a good reference https://www.baeldung.com/spring-boot-data-sql-and-schema-sql

CodePudding user response:

While using Spring Data JPA, you have many ways to instantiate your database when you launch your application. You set this behavior with the spring.jpa.hibernate.ddl-auto=none property, which has 4 values :

  • none: no synchronization with the database
  • validate: validate the schema of the database
  • update: update the structure of the database
  • create-drop: create the schema and then drop it after the application is closed
  • create: just create the database

This link will give you more details.

does it store the autoincrement id's value somewhere in cache?

There are many strategies for autoincrement field and it most of the time managed by the the database.

  • Related