Hibernate Soft Delete and Optimistic Locking Problem
Sometimes, in the database, we will want to not delete stuff because the data might still be needed later. Maybe some other process in the company will have to generate an invoice by the end of the month. That’s also one of the reason in my workplace, why there won’t be any hard delete in the database except when we’re sure it’s really necessary.
One solution for this, in hibernate, is to overwrite the sql delete command using the @SqlDelete annotation: