Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails-在查找期间不允许对列错误使用SQL NULL_Sql_Grails - Fatal编程技术网

Grails-在查找期间不允许对列错误使用SQL NULL

Grails-在查找期间不允许对列错误使用SQL NULL,sql,grails,Sql,Grails,我正在研究GGTS 3.4-在创建域模型VideoDisplayMgmtShr的新实例时,我在创建该域的新实例之前,引入了对h2 dB域模型内容的查询检查。以下是查询: def vidDispMgmLst = VideoDisplayMgmtShr.findAll{ displayMode == videoDisplayMgmtShrInstance.displayMode} 错误是: Class: org.h2.jdbc.JdbcSQLException Message: NULL no

我正在研究GGTS 3.4-在创建域模型VideoDisplayMgmtShr的新实例时,我在创建该域的新实例之前,引入了对h2 dB域模型内容的查询检查。以下是查询:

def vidDispMgmLst = VideoDisplayMgmtShr.findAll{ displayMode == videoDisplayMgmtShrInstance.displayMode}
错误是:

 Class: org.h2.jdbc.JdbcSQLException
 Message: NULL not allowed for column "EXPIRY_DATE";
 SQL statement: insert into video_display_mgmt_shr ...
如果我删除这个检查查询,新实例的保存工作正常-因为expiryDate不为null。我倍感困惑,因为查询没有创建新实例,所以我不明白为什么它会抛出这个错误?此外,expiryDate设置为模型定义中允许的null

最后一件事是,这个域模型与另一个域模型有一个belongsTo约束,但这一切都在create中处理

域类是:

class VideoDisplayMgmtShr {

// Defines the management of all videos that are published

static constraints = {
    description(blank:true, nullable:true)
    startDate(blank:true, nullable:true)
    expiryDate(blank:true, nullable:true)
    pubRights(inList:["Full", "Rest"]) // Full - full publish rights
                                    //Rest- Restricted rights - with a watermark for some concessionary publishing
    displayMode(inList:["Vanilla", "Vimeo", "YouTube"])

   }

static mapping = {
    datasource 'publish'
 }

String description
Date startDate = new Date()
Date expiryDate = new Date() + 100
String pubRights = "Rest"   // display type
String displayMode = "Vanilla" // type/ destination of publication
static belongsTo = [ publishedBT: PublishedShr]
}

此域类属于“另一个域类”:

static hasMany = [vidDMHM: VideoDisplayMgmtShr] // links to a display management entry
不确定这是否相关,但这有另一个映射条件:L

        static mapping = {

            datasource 'publish'

            vidDMHM cascade: "all-delete-orphan"
     }
以前有人见过这样的东西吗


-mike

你能发布一些关于你试图保存的域类的详细信息吗?该类是:class VideoDisplayMgmtShr{static constraints={descriptionblank:true,nullable:true startDateblank:true,nullable:true expireydateblank:true,nullable:true pubRightsinList:[Full,Rest]显示模式列表:[Vanilla,Vimeo,YouTube]}静态映射={datasource'publish'}字符串描述日期开始日期=新日期到期日期=新日期+100字符串pubRights=Rest字符串显示模式=Vanilla静态目录=[publishedBT:PublishedShr]}带静态hasMany=[vidDMHM:VideoDisplayMgmtShr]在另一个类中。@mikek您可以编辑您的问题并在其中添加详细信息,以便于阅读。