In grails i have declared a variable in the Model called. String dnaSequence
I am trying to to save a huge long string
into it and i get the following error message saying its too big.
How can i increase the limit to 900,000
or more ?
How can i achieve this?
Note: The solution given should be something that i can achieve with Grails
.
My Domain class
class Animal {
String dnaSequence
static constraints = {
}
}
The max size of a VARCHAR is set in the database, Grails doesn't have any say in the matter. What you can do is tell Grails what you need, and it will generate DDL that uses a clob instead of a string.
Change the mapping for the column to use type: "text"
, while adding the maxSize you want in your constraints. Grails will figure out from this that it should set the column data type to clob.
(Generally a clob field will hold up to 4GB, though some databases allow changing that.)