i am using Hibernate 4 as a ORM tool within a Angular/Spring/Oracle project.
I have a bidirectional @OneToMany
relationship in my parent class Portfolio
as below:
@OneToMany(mappedBy = "portfolio", fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, orphanRemoval = true)
@JsonManagedReference
private Set<PortfolioContributors> portfolioContributors;
and a @ManyToOne
relationship in my child entity PortfolioContributors
.
@ManyToOne
@JoinColumn(name = "PORTFOLIO_ID", referencedColumnName = "PORTFOLIO_ID", foreignKey = @ForeignKey(name = "FK_PORTFOLIO_CONTRIBUTORS"), nullable = false)
@JsonBackReference
private Portfolio portfolio;
The problem is that if i remove a entry from the set of child entities in parent class. It does not set removed/ deleted from database.
How to achieve this behavior?