//parent class
@OneToMany(mappedBy="parentClass",cascade=CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOV CascadeType.REFRESH}, orphanRemoval =false, fetch = FetchType.EAGE
@CascadeOnDelete
private List<ChildClass> childClass;
//child class
@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.REMOVE,CascadeType.REFRESH})
private ParentClass parentClass;
I am facing some problem in merging.
Sometimes it is working perfectly some time it's not working. For example the first time, I am setting
amount=30 balamount=20 adjamount=10
It is perfectly set. After that I have set
amount=10 balamount=10 adjamount=0
but in database I get
amount=30 balamount=30 adjamount=0
The entity is correctly set. But after committing, the database is not updated correctly.
I am not getting what the problem is. Can you please point out what is the problem in my code?