I've been using spring data rest without any problem but now I have a requirement that when a user performs a DELETE operation on a given entity i.e. DELETE /accounts/<id> I need to set a flag on the database marking that entity as deleted but i do want to keep the record.
Basically this means that I need to do an UPDATE instead of a DELETE operation in the database. I don't find any way to override the spring behavior for the delete(ID) method.
Some code:
@Entity @Table(name = "account") public class Account { /* Default value for this field is false but when a receive a DELETE request for this entity i want to turn this flag to false instead of deleting the record. */ @Column(name = "deleted") private boolean deleted; ... } Account Repository
@RepositoryRestResource public interface AccountRepository extends JpaRepository<Account, Integer> { } Any ideas?