Answer the question
In order to leave comments, you need to log in
How to stop propagation of cascading operations in Hibernate?
How can Hibernate stop propagating cascading operations to child objects?
Example:
public class EmployeeEntity {
@OneToMany(
cascade = CascadeType.ALL
)
@JoinColumn(name = "employee_id", referencedColumnName = "employee_id")
private Set<EmployeeHotelPermissionsEntity> hotelsPermissions = new HashSet<>();
}
public class EmployeeHotelPermissionsEntity {
@ManyToOne()
@JoinColumn(name = "hotel_id")
// <--- остановить cascade = CascadeType.ALL здесь --->
private HotelEntity hotel;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question