Ejemplo 1: sql de importación de primavera
-- You can simply create a data.sql file in your src/main/resources folder
-- and it will be automatically executed on startup.
-- In this file you just add some insert statements, eg.:
INSERT INTO users (username, firstname, lastname) VALUES
('lala', 'lala', 'lala'),
('lolo', 'lolo', 'lolo');
-- If you're using Spring boot 2, database initialization only works for
-- embedded databases (H2, HSQLDB, ...). If you want to use it for other
-- databases as well, you need to change the
-- spring.datasource.initialization-mode property:
spring.datasource.initialization-mode=always
Ejemplo 2: crear un esquema de base de datos automáticamente en jpa spring boot
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=test
spring.datasource.password=
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)