Hi Faizel,

The answer is no. Unsetting a relationship will never delete its target object. 
So you'll need to do it explicitly. 

There are "delete rules" for relationships, but those require the source object 
to be deleted to trigger nullify/cascade/deny action. So that's different.

Andrus


> On Jul 13, 2020, at 12:35 AM, Faizel Dakri <list...@dakri.com> wrote:
> 
> Is there a facility in Cayenne to automatically delete an object when it is 
> removed from an “owning” object’s to-many relationship (and not added to 
> another owning object)? 
> 
> I’m migrating a project from EOF to Cayenne. In the EOF world, there was the 
> concept of a relationship owning its destination, meaning that removing a 
> destination object from that relationship in the source object would also 
> cause that destination object to be deleted from the database on commit 
> without having to explicitly call deleteObject() on it (provided it wasn’t 
> subsequently added to another source object). This automatic deletion would 
> happen during saveChanges() on the editing context.
> 
> Maybe it’s just too obvious and I haven’t been able to recognize it, but I 
> have not been able to find anything similar in Cayenne. Is there such a 
> feature? 
> 
> Thanks,
> 
> F
> 
> -- 
> Faizel Dakri
> 
> 

Reply via email to