First, the query for all student records, grades contain name
1. Create a Student entity class encapsulates property
public class IStudent {
IGrade grade=new IGrade();
public IGrade getGrade() {
return grade;
}
public void setGrade(IGrade grade) {
this.grade = grade;
}
private int StudentNo;
private String loginPwd;
private String StudentName;
private int Sex;
private int GradeId;
private String phone;
private String BornDate;
private String email;
private String IdentityCard;
private String address;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getStudentNo() {
return StudentNo;
}
public void setStudentNo(int studentNo) {
StudentNo = studentNo;
}
public String getLoginPwd() {
return loginPwd;
}
public void setLoginPwd(String loginPwd) {
this.loginPwd = loginPwd;
}
public String getStudentName() {
return StudentName;
}
public void setStudentName(String studentName) {
StudentName = studentName;
}
public int getSex() {
return Sex;
}
public void setSex(int sex) {
Sex = sex;
}
public int getGradeId() {
return GradeId;
}
public void setGradeId(int gradeId) {
GradeId = gradeId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBornDate() {
return BornDate;
}
public void setBornDate(String bornDate) {
BornDate = bornDate;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getIdentityCard() {
return IdentityCard;
}
public void setIdentityCard(String identityCard) {
IdentityCard = identityCard;
}
public IStudent(int studentNo, String loginPwd, String studentName, int sex,
int gradeId, String phone, String bornDate, String email,
String identityCard) {
StudentNo = studentNo;
this.loginPwd = loginPwd;
StudentName = studentName;
Sex = sex;
GradeId = gradeId;
this.phone = phone;
BornDate = bornDate;
this.email = email;
IdentityCard = identityCard;
}
public IStudent() {
// TODO Auto-generated constructor stub
}
}
2. Create an interface layer Dao students to write the query method
Grade way to write a query table
3. Create Tools
4. The realization of the interface layer and inherited tools Dao
5. Test class UI
Second, the inquiry S1年级下的学生记录
Grade 1. Create a table entity class and create a collection of entity classes students
2. The method of preparation of the layer Dao
3. To achieve Dao Interface
4. Test UI layer