@Table 注解详解

版权声明:转载请注明原始链接 https://blog.csdn.net/sswqzx/article/details/84337672

spring @Table注解  作用是 : 声明此对象映射到数据库的数据表,通过它可以为实体指定表(talbe)

常用的两个属性: 
1、name 用来命名 当前实体类 对应的数据库 表的名字 

@Table(name = "tab_user")

2、uniqueConstraints 用来批量命名唯一键 
其作用等同于多个:@Column(unique = true)

@Table(name = "tab_user",uniqueConstraints = {@UniqueConstraint(columnNames={"uid","email"})})

 

猜你喜欢

转载自blog.csdn.net/sswqzx/article/details/84337672
今日推荐