cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <h...@karlmenn.is>
Subject Deleting a bunch of interrelated objects
Date Wed, 29 May 2019 12:34:50 GMT
Hi all.

I have a pretty large model where every to-many relationship's delete rule is "Deny" (I like
being explicit about the data I delete, especially since the DB in question still doesn't
have well specified FKs).

Almost every table in this DB is somehow related to a "Customer" table (sometimes through
a chain of tables) that "owns" data.
I'm now implementing an operation to nuke a Customer (as in "delete everything related to
that customer")—but the data  "owned" by the customer is hugely interrelated, even often
creating circular relations.

Do I have any nice options, given a set of DataObjects, to just tell Cayenne to nuke that
darn data without any consideration for normal delete rules? As in "usually I wouldn't allow
this and Ashwood is very angry at you—but since you really, really want it…".

Note that the whole operation results in a consistent database (even if there are temporary
in-memory inconsistencies due to the circular relationships) since the interrelated data is
all deleted within the operation.

Cheers,
- Hugi
Mime
View raw message