Search code examples
hibernatehsqldbvarchar

How to make hibernate 3.5.6-Final and in memory hsqldb 2.0.0 work together?


After upgrading hsqldb dependency in pom.xml from 1.8.x to 2.0.0+ I started getting this error:

org.hsqldb.HsqlException: length must be specified in type definition: VARCHAR

Obviously, Hibernate generated incorrect CREATE TABLE expression according to HSQLDB 2 requirements. Should I use a different version of Hibernate? Which one? (However, I'd prefer to stick with 3.5.6 for the time being). Or maybe there is a way to use HSQLDB 2 in the back compatible mode?

Thank you.


Solution

  • I suggest you use the latest HSQLDB (2.2.6 at the time or writing) which is on Maven.

    You can override the VARCHAR size enforcement using a URL such as

    jdbc:hsqldb:mem:test;sql.enforce_size=false 
    

    For Hibernate version, better compatibility can be achieved using a more recent version of HSQLDialect.java from Hibernate 3.6.x series. Or just upgrade to the latest 3.6.8