How to name the foreign key constraint of ManyToOne references since JPA 2.1?

后端 未结 3 2074
悲&欢浪女
悲&欢浪女 2021-02-03 23:37

@org.hibernate.annotations.ForeignKey has been deprecated, but I cannot find any examples how the JPA 2.1 equivalent would have to look like?

@ManyT         


        
3条回答
  •  不要未来只要你来
    2021-02-04 00:18

    You're right, I misread the documentation. It can be defined as a part of @JoinColumn annotation.

    It should look like that:

    @JoinColumn(foreignKey = @ForeignKey(name = "FK_USER"))
    

提交回复
热议问题