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

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

    As the documentation indicates, this annotation can't be applied to anything:

    @Target(value={})

    It can thus only be used as part of another annotation (listed in the See Also section):

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

提交回复
热议问题