的連接表中的條目,我有兩個域對象如何刪除從多到許多關係的Grails
Class Attachment{
static hasMany = [mailDrafts: MailDraft];
}
Class MailDraft{
static hasMany = [attachments: Attachment]
static belongsTo = Attachment
}
它創造了三個表
1)attachment
2)mail_draft
3)attachment_mail_drafts
attachment_mail_drafts: id, mail_draft_id
現在,我wnat到寫一個HQL查詢to delete an entry from the table 'attachment_mail_drafts' where 'attachment_id' is 4
,那麼查詢是什麼。