【发布时间】:2012-02-13 22:07:35
【问题描述】:
我的域类如下所示:
package com.initech.tps
class Foo
{
String stuff
static mapping = {
// mapping to a legacy table as opposed to letting Grails create it
table name: 'FOO', schema: 'TPS'
id generator: 'sequence', params: [sequence: 'MY_SEQ'],
column: 'FOO_ID', sqlType: 'integer'
foo column: 'STUFF'
}
static constraints = {
stuff(nullable: true, maxSize: 40000)
}
}
我的印象是 Grails 会根据我为 maxSize 约束传递的足够大的值来计算使用 CLOB 而不是 VARCHAR,但我在控制台中收到以下错误消息:
org.hibernate.HibernateException: Wrong column type in FOO for column STUFF.
Found: clob, expected: varchar(40000)
我需要一个显式的 sqlType 映射吗?我尝试使用不同的 maxSize 值,并完全忽略它,没有区别。另外添加sqlType: clob 或sqlType: text 也不起作用。
我在 Grails 1.3.7 上,使用 IBM DB2-Express。
【问题讨论】:
标签: grails groovy orm db2 grails-orm