JPA创建实体类映射表+ 创建索引
Posted dream_heheda
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JPA创建实体类映射表+ 创建索引相关的知识,希望对你有一定的参考价值。
创建表 tb_student + 创建索引
主键:studentId
索引:
- 联合索引: index_tb_student
- 单个索引: index_student_studentName
- 单个索引: index_student_studentAge
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import lombok.Data;
@Data
@Entity
@Table(name = "tb_student",
indexes = @Index(name = "index_tb_student", columnList = "classNo,studentName"),
@Index(name = "index_student_studentName", columnList = "studentName"),
@Index(name = "index_student_studentAge", columnList = "studentAge") )
public class Student
@Id
private String studentId;
@Column
private String studentName;
@Column
private Integer studentAge;
@Column
private String classNo;
@Column(precision = 18, scale = 4)
private BigDecimal height;
@Column
private Date lastModiftyDate;
以上是关于JPA创建实体类映射表+ 创建索引的主要内容,如果未能解决你的问题,请参考以下文章
jpa,试图从实体创建表,找不到类 ExpressionVisitor