How to soft delete a record in Hibernate or JPA / Soft deletion of Entities in Hibernate or JPA

Soft Delete !!! What the heck ?

Soft delete means that the record is not removed from the database table but a flag is set to a value which indicates that this record should not be fetched while fetching the records from this table. The flag shall be a value of a column in the table itself.

For example, there is a deleted column in a table which has a value of false for a record which is newly inserted in the table but when a record is deleted, it is not removed from the table but the value of deleted column for this record is set to true. Now when fetching records from the table, only those records should be fetched which have a false in deleted column. (more…)

Continue Reading
  • 1
  • 2
Close Menu