IllegalStateException with Hibernate 4 and ManyToOne cascading

后端 未结 9 2157
梦如初夏
梦如初夏 2020-12-01 16:06

I\'ve got those two classes

MyItem Object:

@Entity
public class MyItem implements Serializable {

    @Id
    private Integer id;
    @ManyToOne(casc         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 16:41

    According to logic in EventCache all entities in object graph should be unique. So the best solution(or is it work around?) is to remove cascade in MyItem to Component. And merge Component separately if it's really needed - I would bet that in 95% of cases Component shouldn't been merged according to business logic.

    From other hand - I really interested to know the real thoughts behind that restriction.

提交回复
热议问题