问题描述
我有一个使用mysql数据库的应用程序,但我想在hsqldb内存数据库中为应用程序运行单元测试。问题在于我的一些持久化模型对象有一些字段,我注释为columnDefinition =TEXT来强制mysql处理长字符串值,但现在hsqldb不知道TEXT的含义。如果我将它更改为CLOB,那么hsqldb很好,但mysql失败。
是否有可用于与mysql兼容的长字符串的标准列定义AND hsqldb ?
通过将连接URL更改为jdbc来启用MySQL兼容模式:hsqldb:mem:testdb ; sql.syntax_mys = true
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?
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
这篇关于在mysql和hsqldb中兼容的TEXT字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!