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

后端 未结 3 2037
悲&欢浪女
悲&欢浪女 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:23

    Do you insert @JoinColumn(foreignKey = @ForeignKey(name = "FK_USER")) direct to mapped to entity example:

    @ManyToOne
    @JoinColumn(foreignKey = @ForeignKey(name = "FK_USER"))
    private User user;
    

提交回复
热议问题