Hello,
I have been trying to solve this issue but cannot find any solution. I have a main class that contains a List of another class. Generated code using the designer below;
//annotations here
public class Main{
@Composition
@OnDelete(DeletePolicy.CASCADE)
@OneToMany(mappedBy = "main", cascade = CascadeType.ALL,fetch = FetchType.EAGER,orphanRemoval = true)
protected List<ChildClass> childClasses;
}
//Child Class
public class ChildClass{
@NotNull
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "MAIN_ID")
protected Main main;
}
The problem is that when I call entityManager.merge, it only saves record of the Main class and not the ChildClass. It works fine when I use persist though.