Hi,
I have an entity with a one-to-many-relationship:
Code:
MyEntity{
List<Child> children;
get and set children..
}
I want to know how I would make Hibernate replace my existing children with a new list of children.
I thought it would be enough to use the setter method of MyEntity (if within a transaction) and then update
MyEntity. But it does not work.
I'm using Hibernate with spring and my 'save-to-database'-method is annotated with the Transactional attribute.
However, the actual call to the set method is done in a separate method (called from 'save-to-database'-method).
This separate method is not annotated. Should it be?
What actually happens right now is that when using the setChildren method, I ADD more children to my existing list. I would like
to replace to old list with the contents of the new list.
/best regards, Håkan Jacobsson, Sweden