Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String size in Grails too big for database field

Tags:

grails

I have Message domain class that is used to send an email to site administrators

class Message {

  String name
  String subject
  String body

}

I thought String would not have a maximum size but when people put in messages that are too big then I see exceptions in my log files. For now I put a constraint in to limit the size of the message to 250 but cannot make it bigger or else the save fails. I am using PostgreSQL 9.1.1 and Grails 1.3.7. Does anyone know a way to fix this?

like image 309
animalfindingstuff Avatar asked Feb 25 '12 19:02

animalfindingstuff


1 Answers

You can specify the data type using a constraint:

static constraints = {
  body type:'text'
}
like image 92
proflux Avatar answered Sep 21 '22 17:09

proflux