【问题标题】:grails 2.3.1 issue with maxSize of 25000 with mysqlgrails 2.3.1 问题与 mysql 的 maxSize 为 25000
【发布时间】:2014-06-19 17:16:46
【问题描述】:

我得到一个奇怪的行为,将约束应用于我的域类中的字符串文本:

class MyClass {
    String field

    static constraints = {
    field nullable: true, maxSize: 25000
    }
}

在我的字段中应用 25000 的 maxSize 时,我从控制台收到以下错误:

Column length too big for column 'promo_text' (max = 21845); use BLOB or TEXT instead

更改maxSize解决了我的问题,但是为什么GORM没有自动转换呢?

我可以在哪里举报?

斯奈特

【问题讨论】:

    标签: mysql grails grails-orm


    【解决方案1】:

    如果你不想设置最大尺寸,那么你可以使用type: "text",比如

    class MyClass {
      String field
    
      static constraints = {
        field nullable: true
      }
    
      static mapping = {
        field type: "text"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-13
      相关资源
      最近更新 更多