2
У меня есть 4 класса, инциденты, проблемы, запросы и другое - это Приложение.принадлежит нескольким доменам
Каждый домен выглядеть .........
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» не может быть пустым. Что делать?
если удалить эти отношения, то это позволит мне каскадное удаление? – sanghavi7
Для удаления каскада попробуйте добавить каскадное сопоставление. Я обновил ответ. –
Да, человек Это работает красиво, thanx – sanghavi7