Hello, I like the features of GORM provided, so I try to use it in my projects.
Here's my environment setting:
Grails Version: 3.1.6
Groovy Version: 2.4.6
JVM Version: 1.8.0_51
the hibernate is using the default setting, which is:
compile "org.hibernate:hibernate-core:5.1.1.Final"
compile "org.hibernate:hibernate-ehcache:5.1.1.Final"
MySQL version is 5.6.17
I'm running this on Windows 10.
I hope the GORM could automatic generate the DB table looks like this:
| Field | Type | Null | Key | Default | Extra |
| logtype | enum('DEBUG','INFO')| NO | | NULL | |
the SQL scheme looks like this:
create table Todo2 (id bigint not null auto_increment, primary key (id), logType enum("DEBUG", "INFO")) ENGINE=InnoDB
set the enumType
to string or ordinal
, but the result is same, the mapped table is not correct.
Anyone can help me?
class Template {
enum LogType {
DEBUG("DEBUG"), INFO("INFO")
String name
LogType(name) {
this.name = name
}
}
LogType lt
static constraints = {
}
static mapping = {
table "Template"
lt sqlType: "enum", enumType: 'string'
}
}