My approach has usually been to create some type of 'active' flag for a record that gets set when it is soft deleted. Then, at regular intervals, the records with the soft delete active flag are dealt with, either deleted or moved to a history table or something.
Joined: Jun 16, 2008
Thanks for the response.
I think maintaing flag will work fine as you said.
Now i have many search queries on this entity..
how can i exclude the records with deleted flag true, with least change of code ??
Any of the implementation JPA or the other.
I face the same situation.
I have a master table where i have a separate entity the reference table doesn't have the entity class. I have used the @SQLDelete annotation to restrict the delete operation into update operation on the master table but the reference table record gets deleted automatically when entityManager.remove() is called.
Is there is any possible way to restrict the delete operation performed on the reference table which doesn't have an entity class.