Search code examples
mysqlhibernatehsqldb

TEXT field that is compatible in mysql and hsqldb


I have an application that uses a mysql database but I would like to run the unit tests for the application in a hsqldb in-memory database. The problem is that some of my persistable model objects have fields which I have annotated as columnDefinition = "TEXT" to to force mysql to cater for long string values, but now hsqldb doesn't know what TEXT means. If I change it to CLOB, then hsqldb is fine but mysql fails.

Is there a standard column definition that I can use for long strings that is compatible with mysql AND hsqldb?


Solution

  • What worked for me was to just enable MySQL compatibility mode by changing the connection URL to jdbc:hsqldb:mem:testdb;sql.syntax_mys=true