简体   繁体   English

使用gorm grails中的虚拟列保存实体

[英]Save entities with virtual columns in gorm grails

So , in my application i have a entity with a virtual column. 因此,在我的应用程序中,我有一个带有虚拟列的实体。 The column takes values depending on what i save in another column. 该列取值取决于我在另一列中保存的内容。

On save i have the following error: 保存时,我遇到以下错误:

java.sql.BatchUpdateException: ORA-54013: INSERT operation disallowed on virtual columns java.sql.BatchUpdateException:ORA-54013:禁止对虚拟列执行INSERT操作

This is because i am sending a null value on that field. 这是因为我在该字段上发送了一个空值。

Does anybody know how to map a virtual column in gorm? 有人知道如何在gorm中映射虚拟列吗?

Thanks 谢谢

Grails derived properties might provide the functionality you need. Grails派生的属性可能提供您需要的功能。

http://grails.org/doc/latest/guide/GORM.html#derivedProperties http://grails.org/doc/latest/guide/GORM.html#derivedProperties

The extended GORM mappings plugins allows you to mark individual columns to be excluded from inserts and updates. 扩展的GORM映射插件使您可以标记要从插入和更新中排除的各个列。

Example: 例:

static mapping = {
    readOnlyColumn updateable: false, insertable: false
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM