'Jpa soft delete put parent id null on child on OneToMany relation

I'm trying to implement a soft delete in a relation OneToMany The parent entity has the relation

@Getter
@Setter
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)
@JoinColumn(name = "parent_id")
private List<Child> childs;

And the Child Entity has this relation

@Getter
@Setter
@JoinColumn(name = "parent_id", nullable = false)
@ManyToOne(optional = false)
private Parent parent;

The annotations for Entity for soft delete implementation in child is

@Entity
@Table(name = "childs")
@Where(clause = "active = true")
@SQLDelete(sql = "UPDATE childs SET active = false WHERE prm_pk=?")

With this configuration when I remove a child from parent the status change to false but the parent_id is set to null. I need that only change the status and the parent id dont set null value



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source