Reputation: 576
In Spring boot app I'm trying to load on startup import.sql file with my sql schema for testing app. Weird problem because the same sql file works when I'm adding its by hand to my DB.
sample of import.sql:
INSERT INTO car
(name, description, price) VALUES
('Audi Q7', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse libero ex.', 150),
('Audi A4', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse libero ex.', 79.99),
...
spring boot startup listing:
sample of error:
HHH000388: Unsuccessful: INSERT INTO car
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
HHH000388: Unsuccessful: (name, description, price) VALUES
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'name, description, price) VALUES' at line 1
...
Upvotes: 1
Views: 826
Reputation: 21103
That is because the entries in import.sql
shouldn't span multiple lines. Hibernate reads it per line and executes each line read as a single statement.
Upvotes: 4