Hi Filipe,
Have you thought about changing the delete rule in the reference attribute to delete?
In that case you would only need to delete the records in one entity and the corresponding records in the other entity would also be deleted.
Cheers,
Tiago Simões
In that case you should do 2 advanced queries and they will run in the same transaction (all db actions in an request will run in the same transaction unless there is an explicit commit).