Hibernate - Constraint Name

前端 未结 1 622
既然无缘
既然无缘 2020-12-10 18:37

Does anybody knows how to set the constraint name for primary key (PK_[name]) ,check (CK_[Name]),Default [DF_[Name]], Foreign Key (Fk_[Name]) ,Unique .. by using Annotations

相关标签:
1条回答
  • 2020-12-10 19:11

    In JPA, you can do this at class level, using @Table annotation properties, where you specify constraints names. For primary key id mapped to column id:

    @Table(uniqueConstraints = @UniqueConstraint(columnNames = "ID", name = "PERSONS_PK_CONSTRAINT"))
    
    0 讨论(0)
提交回复
热议问题