使用Objectdb开发此关系数据库。有人可以帮助修复此代码。我正在做一个关系数据库来显示学生成绩。新的,所以我在某个地方出了问题..
package Student;
import java.io.Serializable;
import java.sql.Date;
import javax.persistence.*;
@Entity
public class students implements Serializable {
private static final long serialVersionUID = 1L;
@studentid @GeneratedValue
private long id;
}
@embeddable
public class Student {
int studentid;
String firstname;
String surname;
char gender;
Date dob;
String address1;
String address2;
String address3;
char postcode;
int phonenumber;
int courseid;
}
@Entity
public class courses implements Serializable {
@EmbeddedId Course id;
:
}
@Embeddable
public class course {
int courseid;
string coursename;
date coursestartdate;
date courseenddate;
}
@entity
public class moduledetails implements Serializable {
private static final long serialVersionUID = 1L;
@moduleId @GeneratedValue
private long id;
}
@Embeddable
public class module {
int moduleid;
String modulename;
int courseid;
int lectureid;
}
@entity
public class lecturedetails implements Serializable {
private static final long serialVersionUID = 1L;
@lectureId @GeneratedValue
private long id;
}
@Embeddable
public class lecture {
int lectureid;
String lecturename;
String lecturedepartment;
}
@entity
public class resultdetails implements Serializable {
private static final long serialVersionUID = 1L;
@studentId @GeneratedValue
private long id;
@Embeddable
public class result<Varchar> {
int studentid;
int courseid;
int moduleid;
Varchar modulename;
char grade;
}
}
谢谢!
答案 0 :(得分:1)
注释@studentid,@ moduleId和@lectureId无效。使用@Id。