Foreign key constraint failure when trying to insert because of key change

后端 未结 2 1679
梦谈多话
梦谈多话 2021-01-24 06:34

I have a Content object which refers to a set of Tag objects in a ManyToMany relationship. As part of persisting a new Content object I look in PostgreSQL to see if the Tag alr

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-24 07:13

    change the configuration of your relation in content entity to this:

    @JoinTable(name = "content_tag",
            joinColumns = @JoinColumn(name = "content_id"),
            inverseJoinColumns = @JoinColumn(name="tag_id")
    )
    

提交回复
热议问题