更新时间:2023-12-01 14:51:46
您没有在@ ManyToOne上设置@JoinColumn,因此它们获得默认的连接列名称。你需要给,
You are not setting the @JoinColumn on the @ManyToOne's so they get the default join column name. You need to give,
@JoinColumn(name="PROVIDER_ID", insertable=false, updateable=false)
@JoinColumn(name="CONSUMBER_ID", insertable=false, updateable=false)
当您从EmbeddedId编写字段时,您需要将它们标记为只读(或者您可以将其标记为insertable = false,updateable = false)
You need to mark them as read-only as you are writing the field from your EmbeddedId (or you could mark it as insertable=false, updateable=false)
但是真的你应该完全删除EmbeddedId,只需将@Id添加到@ ManyToOne并定义一个@IdClass。
But really you should remove the EmbeddedId entirely and just add @Id to the @ManyToOne's and define an @IdClass.