Reputation: 1301
I have the following mapped in my entity:
@OneToMany(mappedBy="categoryScheme")
private Set<RolePlayerCategorySchemeRel> rolePlayerCategorySchemeRelationshipsAsSet = new HashSet<RolePlayerCategorySchemeRel>();
@OneToMany(mappedBy="parentCategoryScheme")
private Set<CategoryScheme> childCategorySchemesAsSet = new HashSet<CategoryScheme>();
The sets are children of the entity based on IDs. I am changing the ID of this entity, which should make the child sets change, but they're not. It's because Hibernate isn't for some reason going back out to the database and updating the sets.
So, the question is: Is there a way to force Hibernate to update/refresh these sets from the database?
Thanks, Dale
Upvotes: 0
Views: 782
Reputation: 11
I had the same problem & came here looking for an answer, but didn't find one.
HOWEVER, I did finally solve my problem. I had the 'inverse' parameter of my Set mapping set to 'true', and the behavior was similar to what you were describing above; changing it to 'false' corrected the problem. From what I was able to see in one of the manuals, the side of the relationship where inverse is false ends up controlling the update behavior.
Hope this helps you.
Upvotes: 1