UPDATE
If you have a lot of stuff in your database, you can also create a new database via Project Settings | tab Configurations. Then you start with a clean database. At a later moment, you can delete your old one.
------------------------------------
Thanks for the clear context. In general I strongly recommend using Mendix so much as possible. If it’s too complex or not possible in Mendix, you can use Java.
In your case you want to delete entities where specific constraints.
Hi Sneha, does this blogpost help you?
https://www.mendix.com/blog/easy-xpath-retrieval-in-java/