Hibernate Soft Delete Spring Boot Behavior

Asked

Viewed 118 times

1

I wonder if there is soft delete functionality in Hibernate, because today I am doing in a way that I consider gambiarra, something to type:

@Entity
@Where(clause="ativo=1")

Controller:

Rejeicao rej = rejeicaoRepository.findOne(id);
if(rej != null){
    rej.setAtivo(0);
    rejeicaoRepository.save(rej);   
}

If anyone has any better way to do it I’d appreciate it

  • 1

    Currently has no native, not completed versions RELEASE: Issue

  • I agree native does not even have, but does it have some less "gambit" to do ?

  • I use a custom base repository, from there darlings specific to each case. In addition, I use some metadata in entities, such as to check whether it can actually be deleted (or not just logically), etc., but never used in controllers or services.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.