1

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:

Listing on GitHubGist

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
...
1
  • 2
    Some JPA providers support "new line" syntax (e.g DataNucleus), and some don't. Yours doesn't. Commented Mar 8, 2017 at 7:14

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.