インシデント、問題、リクエストの 4 つのクラスがあり、もう 1 つは添付ファイルです。
すべてのドメインは次のようになります........
Class Incidents
{
// other fields
static hasOne = [attachment: Attachment]
static constraints = [attachment nullable:true]
}
Class Problems
{
// other fields
static hasOne = [attachment: Attachment]
static constraints = [attachment nullable:true]
}
Class Requests
{
// other fields
static hasOne = [attachment: Attachment]
static constraints = [attachment nullable:true]
}
Class Attachment
{
// other fields
static belongsTo= [
incident: Incidents,
problem: Problems,
requests: Requests
]
static constraints = {
incident nullable: true
problem nullable: true
requests nullable: true
}
インシデントのオブジェクトを保存しているときに、Column 'problem_id' cannot be null のような例外がスローされます。何をすべきか?