We're currently using h2 1.2.135 and Hibernate 3.3.2.
When our Web application (running in Tomcat) starts up, Hibernate thinks
that the tables don't exist (even though they do), e.g.:
[java] KS 2010-05-26 22:45:35 [main] INFO
o.h.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
[java] KS 2010-05-26 22:45:35 [main] INFO
o.h.tool.hbm2ddl.SchemaUpdate - fetching database metadata
[java] KS 2010-05-26 22:45:35 [main] INFO
o.h.tool.hbm2ddl.SchemaUpdate - updating schema
[java] KS 2010-05-26 22:45:35 [main] INFO
o.h.tool.hbm2ddl.DatabaseMetadata - table not found: CACHED_CONTACTS
So Hibernate then tries to create the tables, which fails (because they
already exist):
[java] KS 2010-05-26 22:45:35 [main] ERROR
o.h.tool.hbm2ddl.SchemaUpdate - Unsuccessful: create table
CACHED_CONTACTS (CONTACT_ID bigint generated by default as identity,
email varchar(128) not null, externalId varchar(256) not null, title
varchar(64), ADDRESSBOOK_ID bigint, primary key (CONTACT_ID))
[java] KS 2010-05-26 22:45:35 [main] ERROR
o.h.tool.hbm2ddl.SchemaUpdate - Tabelle "CACHED_CONTACTS" besteht bereits
[java] Table "CACHED_CONTACTS" already exists; SQL statement:
[java] create table CACHED_CONTACTS (CONTACT_ID bigint generated
by default as identity, email varchar(128) not null, externalId
varchar(256) not null, title varchar(64), ADDRESSBOOK_ID bigint, primary
key (CONTACT_ID)) [42101-135]
Does anybody have an idea what's going wrong? (The Web application runs
fine, but we'd like to automatically manage schema diffs and therefore
need SchemaUpdate and DatabaseMetadata to work correctly with h2.)
Thanks and best regards,
Paul
I'm not sure what the problem might be. What is your database URL and
Hibernate configuration? That's the most important information I need.
Then, could you add ";TRACE_LEVEL_FILE=3" to the database URL and post
(or send me) the .trace.db file(s). There is only one file when using
the embedded mode, but multiple files when using a remote protocol.
Regard,
Thomas