I have two domain classes:
class Contract {
String refNo
}
class Attachment {
byte[] data
String mimeType
String fileName
}
How can I set up the relationships so that I have both contractInstance.attachment and attachmentInstance.contract? I think this is bidirectional one-to-one but I’m not sure (one Contract has to have exactly one Attachment)…
This define a 1-to-1 relationship between the two, with Contract being the owner of the relationship. This means that if you save/delete a Contract the save/delete will cascade to the Attachment, but the inverse is not true.