Hey,
In our application we have decided to add ‘erasion validation’ – By using pre-delete, we catch all entities erasion requests, and check by querying the DB whether any applicative* references exist to the deleted entity
(* Applicative reference is a reference which can be seen in the java object, and won’t be automatically deleted once the requested entity is removed)
The problem is, that before we run the erasion validation – we make some applicative changes, and then querying the DB by using SQL statements. In this level, the application references are not synchronized with the DB references, and not all applicative changes are reflected in the DB.
One kind of solution will be Flush the DB before executing the validation queries. This solution is bad since we catch the delete at ‘pre delete’ stage, and flushing during cascade (which may happen if we delete a hierarchy of objects) is wrong.
Any better ideas of how can I ensure the DB is synchronized with my java application?
Thanks in advance,
Sharon.
|