Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data truncation: Data too long for column grails GSP field

Tags:

grails

gsp

I have this domain class in my project. This is a sample

public class empHistory {

String respField
String addInfo

static constraints = {

        respField(nullable: true, maxSize:100)
        updatedByUser(nullable: true, maxSize:100)
    }

after providing the field value for both fields when i click ok its displaying the following error

Data truncation: Data too long for column 'respField' in row 1
like image 978
user3679427 Avatar asked Mar 05 '26 15:03

user3679427


1 Answers

I think you may have entered more than the specified max value. so if you need to expand the size for example you can do like this

public class empHistory {

String respField
String addInfo

static constraints = {

        respField(nullable: true, maxSize:2000)
        updatedByUser(nullable: true, maxSize:2000)
    }

If dbcreate status is update change it to create or create-drop then try to run your application again. it's because the database is already created in the first constraint.

like image 50
abdul Avatar answered Mar 08 '26 17:03

abdul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!