|
[
Permalink
| « Hide
]
Mike Heath added a comment - 11/Dec/06 04:12 PM
We're having a problem with this too. We would like to upgrade to 3.2.1 but this issues is currently preventing us from doing so. Frankly, I'm surprised more people haven't seen this problem.
One other note. It only seems to not work when a new Collection is created and set in the detached entity. If the existing colleciton is modified:
animal.getCountries().clear(); animal.getCountries().addAll(countries) then it works fine as well. However, in order to get that to work I had to make the many to many fetch eager for Animal. I believe you forgot to set cascade=MERGE, PERSIST on your association (this is at least true for case #1).
I still see something weird when the collection is deferenced. test in org.hibernate.test.ops.MergeTest#testMergeManyToManyWithColelctionDeference ugh! Somehow when the collection is a "bare reference" the original detached collection collection is being mutated in addition to the merged/persistent collection. I need to find the cause of that, which would probably be the cause. From what I can tell, that is the reson the in memory state is fine after the merge but the merged changes are not persisteted (because after the in memory merge the two collection look the same).
Actually has nothing to do with many-to-many; the same should occur with one-to-many or value-collection...
Thanks. I just realized the email address I had associated with this jira was bad so I didn't notice you were working on it. I'll verify the fix next week.
Mike Works great now, thanks.
|
|||||||||||||||||||||||||||||||||||||||||||||