0

When using embedded HSQLDB to unit test, it seems the schema and/or the catalog defined in the hibernate entity mapping file can't be handled correctly. The hibernate mapping looks like

<class name="ca.zl.Orders" table="Orders" schema="dbo" catalog="db1">

With the property "hibernate.connection.url" set to "jdbc:hsqldb:mem:db1", I always got the following errors

org.hibernate.tool.hbm2ddl.SchemaExport: user lacks privilege or object not found: DB1 org.hibernate.tool.hbm2ddl.SchemaExport: invalid schema name: DBO

This seems caused by HSQLDB by default only has one catalog named "PUBLIC", see document here.

I can't change the hibernate entity mapping, I don't want to use other database engine (I know H2DB can handle this). Can anyone shed a light on how to make HSQLDB work in this unit test context?

2
  • create schema db1?
    – user330315
    Commented Aug 11, 2015 at 17:35
  • If you have to use a catalog name, rename the default one. ALTER CATALOG PUBLIC RENAME TO DB1
    – fredt
    Commented Aug 11, 2015 at 19:24

0

Your Answer

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

Browse other questions tagged or ask your own question.