- 普通索引
name是索引名称(自定义的),columnList是字段名@Entity @Table(name = "dm_question", indexes = {@Index(name = "status", columnList = "status")})
-
联合索引
使用相同的name来标明一个多字段组成的联合索引
@Table(name = "dm_sms", indexes = { @Index(name = "phone_code_status_index", columnList = "phone"), @Index(name = "phone_code_status_index", columnList = "code"), @Index(name = "phone_code_status_index", columnList = "status") } )
-
唯一索引
使用注解 @UniqueConstraint 来表示一个唯一索引@Entity @Table(name = "dm_ins_symbol", uniqueConstraints = {@UniqueConstraint(columnNames = {"insId"})})
可以支持多个字段组成一个唯一索引
uniqueConstraints = { @UniqueConstraint(columnNames = {"key2","key3"}) },
Springboot实体类配置索引注解
最新推荐文章于 2023-07-02 09:00:00 发布