Re: Owns destination and other relationship constraints ...
Jean-François Veillette <[email protected]> Wed, 14 Apr 2004 20:11:28 -0400
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <[email protected]> |
Le 04-04-14, à 03:35, Ashley Aitken a écrit : > > Howdy All, > > My understanding of relationships that own their related objects in > EOF is that objects are (automatically) deleted (in Java and, as a > result of EOF, from the database) when they are removed from a > relationship. > > Two questions: > > 1. How does one move an object from one aggregate to another? Does > it just work, to remove it from one aggregate and add it to another, > for example, in code, or will this cause a problem. it's actually not deleted until you do saveChanges. so yes, you can remove from one relationship, add to another, then do saveChanges. It may cause problem if you hold a reference to such object, save changes, and then try to add it back. I think it can be hacked to work if you pull the right strings (the globalId is no longer valid, and it's not a new-inserted-globalId, you would have to make ec to forget that object first, removing it's gid references). > 2. If you have a relationship set as "owns destination" *must* the > reverse relationship be mandatory and cascade or deny delete? > Optional and nullify or no-action sound problematic. no, it "must" not be mandatory, but it certainly make sense that it be, but no obligation. I doubt the reverse relationship should ever be cascade. but that's your business model, it can be whatever your business model is. - jfv