在我的域对象中,我有一张 map :
Map<String, String> stuff
GORM 自动创建一个表,其中键和值是 varchar(255) .
我需要值是 长文本 反而。我怎么做这件事?
另外,是否有不涉及使用休眠配置的解决方法?
最佳答案
我认为您可以在域类的映射闭包中声明此设置。
约束字符串字段,使其 MySQL 列类型为 TEXT:
static mapping = {
myTextField type: 'text'
}
也许这可以帮助您:Grails 指南 (5.5.2.1 Table and Column Names)
关于grails - Gorm : how to set datatype of a value in a Map,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5658327/