0

This is my model.

class Review {
String review
Date date
int numberOfComments
String status
static belongsTo = [game:Game, user:User]
static hasMany=[comment:Comment]
static mapping ={
    numberOfComments    defaultValue: "0"
    review type: 'text'
}

static constraints = {

}

when I inputted 400 character text it generated this error

enter image description here

I don't know why the review type: 'text' is not working. can someone help?

Red Viper
  • 477
  • 1
  • 5
  • 22

3 Answers3

0

Maybe you can use an sqlType instead like

class Email {

    String body

    static mapping = {
        body sqlType: "longtext"
    }
Ricardo Umpierrez
  • 768
  • 2
  • 11
  • 24
0

you can make it a blob type

static mapping = {
    review (type:’blob’)
}

Note type is default properties for Grails 2.0, if you use newer version of grails you should use sqlType.

Check it here: http://grails.github.io/grails-doc/latest/ref/Database%20Mapping/column.html

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
0

In fact grails GORM sometimes have problems with updating column types, especially if they contain any data. Try to delete selected column/table in database and restart application.

Ensure also that you have changed in conf/DataSource.groovy

dbCreate = "update"

to

dbCreate = "create-drop"

Edited: Firstly I didn't notice that you are using h2 db. Please check out this answer for text type in h2 database.

Community
  • 1
  • 1
Michal_Szulc
  • 4,097
  • 6
  • 32
  • 59