I have a data module that includes Vendor
objects and VendorCategory
objects. Each vendor has multiple categories, and each category can have multiple vendors.
I need to list all vendors under a given category, and all categories under a given vendor.
The primary operations are on vendors, so I'm writing code to update/delete VendorCategory
objects based on edit operations on vendors.
I'd like these operations to be transactional: i.e. a vendor category has its refcount updated iff the vendor creation/deletion/edit goes through, and not otherwise. But I've got things set up as an unowned many-to-many relationship, so AFAIK it's not possible to use transactions, since they're in different entity groups.
Is there a better way to model this relationship? Do I need to just suck it up and live with the nontransactional nature of the beast? I've thought about using the task queue to go through and clean up the relationships periodically, is that the best way?