I wanted to create a project with hibernate, spring mvc and H2 as (at the moment) in the memory database. When everything loads (in the berth), I get errors saying that the tables are not yet present.
This is the error I get:
Okt 09, 2013 3:42:47 PM org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: HHH000227: Running hbm2ddl schema export Okt 09, 2013 3:42:47 PM org.hibernate.tool.hbm2ddl.SchemaExport perform ERROR: HHH000389: Unsuccessful: alter table PUBLIC.Object drop constraint FK_9sd2x4ehbugdjyrp1xqmsjw00 Okt 09, 2013 3:42:47 PM org.hibernate.tool.hbm2ddl.SchemaExport perform ERROR: Tabelle "OBJECT" nicht gefunden Table "OBJECT" not found; SQL statement: ...
This would be normal if I did not install Hibernate, for example:
hibernate.hbm2ddl.auto=create
and connection string for H2:
jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE
I can connect to the database using IntelliJ, so there is one.
I expected Hibernate to generate tables for me, and then the constraints and everything else, but for some reason it does not. Could this be user rights? these are the user settings that I set:
jdbc.user=sa jdbc.pass=
Any help is appreciated! Thanks:)
UPDATE
If I changed the connection string to this:
jdbc.url=jdbc:h2:~/db/database.db;DB_CLOSE_ON_EXIT=TRUE;INIT=create schema IF NOT EXISTS generic;
it works. But why it doesn’t work in memory and why it didn’t work before, when I set the default scheme to “public” (which was already there, so I decided that I could just dump my things there ...) IDK!