【问题标题】:GORM: nullable constraint for domain map valueGORM:域映射值的可空约束
【发布时间】:2012-10-15 14:56:08
【问题描述】:

我有一个带有地图对象的 GORM 域类。

class MyClass {
    Map<String, String> myMap

    static constraints = { ... }
}

默认情况下,myMap 中的值不可为空。有没有办法配置约束,使 myMap 中的值可以为空?

【问题讨论】:

    标签: grails map grails-orm nullable


    【解决方案1】:
    static constraints = {
        myMap nullable: true
    }
    

    documentation

    【讨论】:

    • 这对我不起作用。我正在使用带有 oracle 的 grails 2.1.0。 myMap.key 可以为空,但 myMap.value 不能。
    猜你喜欢
    • 1970-01-01
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-14
    • 2021-07-02
    • 2013-08-30
    • 1970-01-01
    相关资源
    最近更新 更多