deleted object would be re-saved by cascade (remove deleted object from associations)

后端 未结 18 1153
轮回少年
轮回少年 2020-11-30 00:19

i have the following two entities:

1- PlayList:

@OneToMany(fetch = FetchType.EAGER, mappedBy = \"playlist\", orphanRemoval = true, c         


        
18条回答
  •  一生所求
    2020-11-30 01:10

    I was able to resolve this by writing the code below. I used executeUpdate instead of .delete()

    def publicSupport = caseObj?.client?.publicSupport
            if(publicSupport)
                PublicSupport.executeUpdate("delete PublicSupport c where c.id = :publicSupportId", [publicSupportId:publicSupport.id])
                //publicSupport.delete()
    

提交回复
热议问题