I have an entity called category. A category can have many items. I am using "set" to have an association between categoty and items.
So I get the list of items like this.
Set items = category.getItems()
Now I need to update an item in the retrieved list. There are two ways I could think of
1) Using the item id get the itme from the DB and update the itme. In this case the category doesn't come into picture. 2) Update the set with the updated item and then save category. I have set cascade="all" so it should work. But in this case it will be a new set and then hibernate will delete all the items in the set and will populate them again.