【问题标题】:Spring jpa Exception - Found shared references to a collection [duplicate]Spring jpa Exception - 找到对集合的共享引用[重复]
【发布时间】:2019-10-24 13:20:37
【问题描述】:

异常

org.springframework.orm.jpa.JpaSystemException: Found shared references to a collection: lk.pwc.projects.rdd.rims.entitymanagement.domain.common.Land.deedList; 
nested exception is org.hibernate.HibernateException: Found shared references to a collection: lk.pwc.projects.rdd.rims.entitymanagement.domain.common.Land.deedList

导致问题的代码段

    @ElementCollection(fetch = FetchType.LAZY)
    @CollectionTable(name = "land_application_upload_deed", joinColumns = @JoinColumn(name = "land_application_id"))
    private Set<LandDeed> deedList;

上面的映射抛出错误

【问题讨论】:

    标签: java mysql hibernate spring-boot spring-data-jpa


    【解决方案1】:

    每当您重新初始化集合属性时,都会发生这种情况。在您的情况下,它是“deedList”。不要重新初始化它,只需清除它并在其中添加新元素。

    【讨论】:

    • 这个问题来递归映射怎么办?
    猜你喜欢
    • 2020-07-19
    • 1970-01-01
    • 2012-08-12
    • 2010-12-14
    • 1970-01-01
    • 2011-08-07
    • 2012-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多