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

后端 未结 2 1678
梦谈多话
梦谈多话 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")
    )
    
    0 讨论(0)
  • This caused by transaction,U can't read uncommitted data, U may commit a transaction after U create a line of 'tag'.

    0 讨论(0)
提交回复
热议问题