When I want to delete a parent in Hibernate, if there is child is there a mechanism that throws an exception?
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "categoryId")
private Category category;
@OneToMany(mappedBy = "category", cascade = CascadeType.ALL)
private List<Product> productList = new ArrayList<>();
not delete category, if the product belongs to the category.