【发布时间】:2014-06-25 17:21:09
【问题描述】:
我有一个带有 Joda LocalDate 属性的域类。此属性必须是唯一的。
它使用 H2 工作,但使用 MySQL db 我在应用启动时出现此错误:
[SchemaExport.create(l.386)]Unsuccessful: create table [...]
[SchemaExport.create(l.387)]BLOB/TEXT column 'mydate' used in key specification without a key length
如果删除唯一约束,它也适用于 MySQL。
这是一个错误还是我的误解?
我正在使用 Grails 2.2.5。 这里的域片段:
class MyClass {
LocalDate mydate
static constraints = {
mydate(nullable:false, unique:true)
}
}
数据源配置片段:
dataSource {
dbCreate = "create-drop"
driverClassName = "com.mysql.jdbc.Driver"
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
username = "xxx"
password = "xxx"
dbNamer = "myapp"
url = "jdbc:mysql://localhost:3306/${dbNamer}?autoreconnect=true"
logSql = true
}
【问题讨论】: