1

I use h2 db and hibernate 4.

I want to autogenerate db schema from entities and fill in db from import.sql file . Here is relevant hibernate.cfg.xml:

<!-- automatically generate database tables from hibernate entities -->
        <property name="hibernate.hbm2ddl.auto">create-drop</property>
        <!-- initialize db on startup -->
        <property name="hibernate.hbm2ddl.import_files">/import.sql</property>

So when database tables are generated import.sql is called. Here is the first sql statement:

insert into Borrower values (1,"Greece, Aphines, Square street",5,"Antonio");

When hibernate runs this sql statement it gives an error:

    квіт 23, 2015 8:56:43 PM org.hibernate.tool.hbm2ddl.SchemaExport importScript
    ERROR: HHH000388: Unsuccessful: insert into Borrower values (1,"Greece, Aphines, Square street",5,"Antonio")
    квіт 23, 2015 8:56:43 PM org.hibernate.tool.hbm2ddl.SchemaExport importScript
    Column "Greece, Aphines, Square street" not found; SQL statement:
insert into Borrower values (1,"Greece, Aphines, Square street",5,"Antonio") [42122-186]

Adding column names inside insert into statement doesn't help.

This seems to be error of h2 database.

What means this error?

1 Answer 1

6

Try it with replace doulbe quote by single quote as below:

insert into Borrower values (1,'Greece, Aphines, Square street',5,'Antonio');
Sign up to request clarification or add additional context in comments.

2 Comments

What does double quote mean in h2?
I also found that getting rid of MySQL's backquotes ( ` ) made it work too.

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.