将类型从简单字符串更改为文本后的Grails - 对于第1行的列“text”,数据太长

时间:2015-09-16 13:26:50

标签: mysql grails gorm

在域级别的grails 2.3.4中,我添加了一段新代码:

static mapping = {
    text type: "text"
}

之前我只有简单的varblle与名称文字。我将我的sql类型更改为文本(TEXT - 65,535字节)。但是当我试图节省5万个字符时,我得到了:

Data truncation: Data too long for column 'text' at row 1. Stacktrace follows:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'text' at row 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4118)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2375)
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2359)
        at nl.mycubes.questionnaire.engine.QuestionnaireService$_saveLabels_closure21.doCall(QuestionnaireService.groovy:577)
        at nl.mycubes.questionnaire.engine.QuestionnaireService.saveLabels(QuestionnaireService.groovy:560)
        at nl.mycubes.questionnaire.engine.QuestionnaireService.saveQuestion(QuestionnaireService.groovy:502)
        at nl.mycubes.questionnaire.engine.TreeController.saveQuestion(TreeController.groovy:316)
        at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
        at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
        at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
        at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
        at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:0)

删除并创建新数据库。它应该正常工作..