I'm trying to figure out Spring Hibernate - MySQL relationship. My purpose is, when I start the program, it execute the import.sql
file within the classpath. I want to do that without destroy existing tables. I found some documentation about execute sql file on startup.
http://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html
The official spring doc says;
In addition, a file named import.sql in the root of the classpath will be executed on startup.
But, Spring destroy my tables and than execute import.sql file. Is there a way to execute .sql file without lost existing data?
In the below question, he almost wanted the same thing like me.
How to import initial data to database with Hibernate?
But;
This will also work only if hbm2ddl.auto is set to create or create-drop.
I serached a lot but couldn't find a way. Long stroy short, how can I run .sql statement on startup without destroying database?