hibernate insert to a collection causes a delete then all the items in the collection to be inserted again

后端 未结 7 1686
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-17 21:09

I have a many to may relationship CohortGroup and Employee. Any time I insert an Employee into the CohortGroup hibernate deletes the group from the resolution table and ins

7条回答
  •  猫巷女王i
    2020-12-17 22:02

    I had this same problem and with some trial and error found that the deletes did not occur if I used a Set instead of a List as my collection. Irritating, given that I'm using JSF and the UI components will only iterate over Lists. But there it is.

提交回复
热议问题