Hi, I have two entities, one is parent and the other one is child. Parent to Child is OneToMany mapping. And Child to Parent is ManyToOne mapping. As we use JPA, we have mappedBy attribute on OneToMany mapping correctly. So when I create a child entity, add it in the set at the parent and save the child entity, I am seeing only one insert into the child table.
But as part of the transaction when we use JpaTemplate.flush() that is where I see an update into parent table. As the number of child objects in the set are different. Isn't it because of mappedBy attribute we are mentioning that do not update the parent each time an insert into the child table?
Please let me know.
|