简体   繁体   中英

If using Spring Boot and hibernate, should I use data.sql or import.sql to import data into my database, and why?

I am using Spring Boot 1.4.1, MySQL for our different environments (dev, qc, uat, live, staging). We are using H2 for our tests.

Sprint Boot says you can import data using data.sql

Hibernate seems to look for import.sql

Both work independently, but if I include both, only import.sql seems to run.

So, should I use data.sql or import.sql to import data into my database, and why?

I would suggest taking a look in your hibernate.cfg.xml to choose file(s), yes, you can import files or a single file to be loaded in MySQL database. My instincts tell me this is a duplicate.

How to insert default data into table using import.sql file in Hibernate, MySQL Application

当您使用Spring JDBC时使用data.sql ,当您使用hibernate时使用import.sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM