org.hibernate.AnnotationException: No identifier specified for entity: com.bjsxt.hibernate.Teacher

来源:互联网 发布:fgo完整数据取消 编辑:程序博客网 时间:2024/05/19 17:10

org.hibernate.AnnotationException: No identifier specified for entity: com.repast.foresetting.entity.Period


@Entity
@Table(name = "Period")

public class Period  {

    //columns START
    private int id;
    private String periodId;

    @Id
    public int getId() {
        return id;
    }
    @Id
    public void setId(int id) {
        this.id = id;
    }
    public String getPeriodId() {
        return periodId;
    }
    public void setPeriodId(String periodId) {
        this.periodId = periodId;
    }

主要是红字的部分,类前要加

@Entity
@Table(name = "Period")


主键id的get和set方法前要加

 @Id



原创粉丝点击