Hi, In my project, we are maintaining the bidirectional relationship between Parent and Child using @OneToMany( mappedBy) in Parent and @ManyToOne in Child class. Based on the row action property on Parent/Child we call EntityManager.merge() on Parent and Child separately (although both calls may happen in the same transaction). When we call EntityManager.merge(Parent) by clearing out all the children, it is just saving Parent which is what we need. But when call EntityManager.merge(Child), it is saving Child as well as it is doing a select on the Parent and then doing an update on the Parent record as well. We really don't need the Parent to be updated when we just want to save the Child. Any suggestions/ideas are greatly appreciated!
thanks
|