Delete without events

0
Hello, Let me paint a picture of a possible situation in a most likely very familiar LearnNow training management case: We have the entities TrainingEvent and Registration which look like this: Couple of premises: - TrainingEvent can only be deleted if it has no associated Registrations - Registration has ACo and ADe event handlers which update “TotalNumberOfRegistrations” attribute on the associated TrainingEvent Let's say I now want to implement a cleanup policy which deletes old TrainingEvents. Of course I don't want orphaned Registrations, so I'll have to delete these first. But with each delete of a Registration, the associated TrainingEvent is updated (TotalNumberOfRegistrations), and committed. This would mean that if I am cleaning up 100 TrainingEvents, of which each could have 100 Registrations, that I would perform 10.000 unnecessary commits in total on those 100 TrainingEvents, right before I'm deleting them! Of course I have the option to either remove the delete behavior and modify the event handlers, so I can delete TrainingEvents first, and than safely delete orphaned Registrations. Or I could remove the event handlers all together and implement the logic only in those places which influence the TotalNumberOfRegistrations. But let's assume I don't want to do either ;-). I then would like to have the possibility to select “Delete without events” as an option when deleting Registrations in my cleanup event. The Java API has a ‘deleteWithoutEvents’ function, so I was wondering why the Mendix Modeler doesn't provide this option? Seven years ago, Simon Black already asked a similar question, but I couldn't find any other documentation or responses. Thanks in advance for the insights. Greetings Martin
asked
2 answers
1

I agree that this feature is very much needed, as for instance an extra tick box on the delete activity. I have other scenarios where this is also needed. There is a Java action already in the ObjectHandling module from the AppStore. I use that for this functionality.

It calls the exposed method from the Java API you mentioned.

answered
0

That’s a good idea Martin, and it should an option in the Delete action. I recommend you post this in the idea forum. It would be easy to implement given the existence of this feature in the Java API already.

In the meantime, it would be trivial to create a Java action that does this.

answered