Groovy域映射

Lui*_*ixv 7 oracle grails groovy grails-orm domain-mapping

我有一个将pdf报告保存到Oracle DB中.报告的dataType是byteArray.

域定义如下:

static constraints = {
 report(nullable:false)
 company(nullable:false)    
 month(nullable:false)    
}

byte[] report
Company company
Date month
Run Code Online (Sandbox Code Playgroud)

}

不幸的是,这在Oracle DB中定义了一个具有RAW data_type和255的长度的字段.

我该如何将这个字段定义到域类中?应该定义为BLOB?

如果是的话,怎么做?

提前致谢.

小智 7

255是提供给byte []的默认大小.根据您的要求,在约束中指定报告的最大大小.就像是:

static constraints = {
    report(maxSize: 50000000)
}
Run Code Online (Sandbox Code Playgroud)

根据最大大小,将设置DB中的字段类型.(mediumblob,longblob等)