Issues while Processing Large Strings in Grails Application

134 views Asked by At

I am working on grails application. I am getting issues in processing string with length greater then 255 characters. When I try to update a record with string greater than 255 characters I get this exception:

nested exception is org.hibernate.exception.DataException: could not update: 
Caused by: org.hibernate.exception.DataException: could not update: [com.ef.apps.mediasense.recordings.Calls#1]

Caused by: java.sql.DataTruncation: Data truncation

This is attribute in which I strore large string:

static mapping = {      
    tag column:'sessionTag'
}

And, This is the constraint I am applying on this:

static constraints = {
    tag (nullable:true, maxSize:1000)
}

And, If I see the design of table, It looks like this for this attribute: enter image description here

So, Everything seems fine then why It's not allowing me to store string having characters greater than 255.

I have tried this approach too, But no Luck:

static mapping = {
    tag column:'sessionTag', type: 'text'
}

with constraint:

static constraints = {
    tag (nullable:true, maxSize:1000)
}

And If I see the design, It looks like this:

enter image description here

But I am still getting the same issue. I just simply want to store string with greater than 255 characters in Grails. Guide me If I am doing anything wrong or I can achieve this by some other approach.

Thanks for your time and consideration :)

0

There are 0 answers