This is how you could write queries to "mimic" cascade delete:
delete from table2 t2
where exists(select 1 from table3
where t2.id = entityId and EntityName = 'Table2')
delete from table1 t1
where exists(select 1 from table3
where t1.id = entityId and EntityName = 'Table1')
If you have some condition upon which you delete from table3
you should also inlcude it in those queries.
UPDATE
To do it automatically, you need todefine foreign keys with cascade delete action. But only one foreign key can be defined on column, thus you'd need to have two columns - one for referencing table1
and second for referncing table2
. Then on both you'd need define cascade delete.
With current design (one column to reference multiple tables) this isn't possible and you would need to work around (as suggested implement delete trigger on table).