stdcall
stdcall

Reputation: 28880

H2 database schema creation check

I have H2 database generated on the-fly using Hibernate & Spring for my test-cases. I have few weird errors, and I would like to know exactly how the schema looks like in H2. how the tables defined, and how the columns. How can I generate this report during run-time ?

Upvotes: 2

Views: 1109

Answers (3)

Praveen Shendge
Praveen Shendge

Reputation: 303

If you want to know what are the schemas getting generated on the fly. Simply add

<prop key="hibernate.show_sql">true</prop>    

With this you'll be able to debug.

Upvotes: 0

Alex Barnes
Alex Barnes

Reputation: 7218

If the schema is being deployed by Hibernate using hibernate.hbm2ddl.auto=true you could turn on trace logging for org.hibernate.tool.hbm2ddl. This would show you the DDL Hibernate is generating when it creates your schema.

Upvotes: 4

Thomas Mueller
Thomas Mueller

Reputation: 50097

You could run the SQL statement SCRIPT NODATA.

To see the SQL statements that are run against the database, append ;TRACE_LEVEL_FILE=2 to the database URL. This will write all SQL statements to the .trace.db file.

Upvotes: 2

Related Questions