orphanRemoval JPA

Asked

Viewed 4,739 times

1

How orphanRemoval works?

Why when I put it on a list does not work ex:

    @OneToMany(mappedBy = "simulationMedia", cascade = CascadeType.ALL, orphanRemoval = true)
    @JsonIgnore
    private List<SimulationChemicalMedia> simulationChemicalMedias = new ArrayList<SimulationChemicalMedia>();

1 answer

7


Orphanremoval is present in most entity relationship annotations, and serves to define how a removal action assigned to an object will impact on the related objects.

The Orphanremoval marks "daughters" entities to be deleted when you don’t have any other ties to a parent entity, for example when you have a car on a list of cars related to a dealership. If the dealership is excluded, if the car has no link with other dealerships will also be excluded.

Browser other questions tagged

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