JavaWeb项目开发案例精粹-第3章在线考试系统-006实体层
1.
1 package com.sanqing.po; 2 /* 3 * 学生表,保存学生编号,系统密码 4 */ 5 public class Student { 6 private String studentID; 7 private String password; 8 private String studentName; 9 private Integer result; 10 private String sclass; 11 public String getStudentID() { 12 return studentID; 13 } 14 public void setStudentID(String studentID) { 15 this.studentID = studentID; 16 } 17 public String getPassword() { 18 return password; 19 } 20 public void setPassword(String password) { 21 this.password = password; 22 } 23 public String getStudentName() { 24 return studentName; 25 } 26 public void setStudentName(String studentName) { 27 this.studentName = studentName; 28 } 29 public Integer getResult() { 30 return result; 31 } 32 public void setResult(Integer result) { 33 this.result = result; 34 } 35 public String getSclass() { 36 return sclass; 37 } 38 public void setSclass(String sclass) { 39 this.sclass = sclass; 40 } 41 }
2.
1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE hibernate-mapping 3 PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 5 <hibernate-mapping> 6 <class name="com.sanqing.po.Student" table="tb_student"><!-- 每个class对应一个持久化对象 --> 7 <id name="studentID" type="string"><!-- id元素用来定义主键标识,并指定主键生成策略 --> 8 <generator class="assigned"></generator> 9 </id> 10 <property name="password"></property><!-- 映射password属性 --> 11 <property name="studentName"></property><!-- 映射studentName属性 --> 12 <property name="result"></property><!-- 映射result属性 --> 13 <property name="sclass"></property><!-- 映射sclass属性 --> 14 </class> 15 </hibernate-mapping>
3.
1 package com.sanqing.po; 2 /* 3 * 题目类 4 */ 5 public class Subject { 6 private int subjectID; 7 private String subjectTitle; 8 private String subjectOptionA; 9 private String subjectOptionB; 10 private String subjectOptionC; 11 private String subjectOptionD; 12 private String subjectAnswer; 13 private String subjectParse; 14 public int getSubjectID() { 15 return subjectID; 16 } 17 public void setSubjectID(int subjectID) { 18 this.subjectID = subjectID; 19 } 20 public String getSubjectTitle() { 21 return subjectTitle; 22 } 23 public void setSubjectTitle(String subjectTitle) { 24 this.subjectTitle = subjectTitle; 25 } 26 public String getSubjectOptionA() { 27 return subjectOptionA; 28 } 29 public void setSubjectOptionA(String subjectOptionA) { 30 this.subjectOptionA = subjectOptionA; 31 } 32 public String getSubjectOptionB() { 33 return subjectOptionB; 34 } 35 public void setSubjectOptionB(String subjectOptionB) { 36 this.subjectOptionB = subjectOptionB; 37 } 38 public String getSubjectOptionC() { 39 return subjectOptionC; 40 } 41 public void setSubjectOptionC(String subjectOptionC) { 42 this.subjectOptionC = subjectOptionC; 43 } 44 public String getSubjectOptionD() { 45 return subjectOptionD; 46 } 47 public void setSubjectOptionD(String subjectOptionD) { 48 this.subjectOptionD = subjectOptionD; 49 } 50 public String getSubjectAnswer() { 51 return subjectAnswer; 52 } 53 public void setSubjectAnswer(String subjectAnswer) { 54 this.subjectAnswer = subjectAnswer; 55 } 56 public String getSubjectParse() { 57 return subjectParse; 58 } 59 public void setSubjectParse(String subjectParse) { 60 this.subjectParse = subjectParse; 61 } 62 }
4.
1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE hibernate-mapping 3 PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 5 <hibernate-mapping> 6 <class name="com.sanqing.po.Subject" table="tb_subject"><!-- 每个class对应一个持久化对象 --> 7 <id name="subjectID"><!-- id元素用来定义主键标识,并指定主键生成策略 --> 8 <generator class="identity"></generator> 9 </id> 10 <property name="subjectTitle"></property> <!-- 映射subjectTitle属性 --> 11 <property name="subjectOptionA"></property> <!-- 映射subjectOptionA属性 --> 12 <property name="subjectOptionB"></property> <!-- 映射subjectOptionB属性 --> 13 <property name="subjectOptionC"></property> <!-- 映射subjectOptionC属性 --> 14 <property name="subjectOptionD"></property> <!-- 映射subjectOptionD属性 --> 15 <property name="subjectAnswer"></property> <!-- 映射subjectAnswer属性 --> 16 <property name="subjectParse"></property> <!-- 映射subjectParse属性 --> 17 </class> 18 </hibernate-mapping>
5.
1 package com.sanqing.po; 2 3 public class Teacher { 4 private String teacherID; 5 private String password; 6 public String getTeacherID() { 7 return teacherID; 8 } 9 public void setTeacherID(String teacherID) { 10 this.teacherID = teacherID; 11 } 12 public String getPassword() { 13 return password; 14 } 15 public void setPassword(String password) { 16 this.password = password; 17 } 18 }
6.
1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE hibernate-mapping 3 PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 5 <hibernate-mapping> 6 <class name="com.sanqing.po.Teacher" table="tb_teacher"><!-- 每个class对应一个持久化对象 --> 7 <id name="teacherID" type="string"><!-- id元素用来定义主键标识,并指定主键生成策略 --> 8 <generator class="assigned"></generator> 9 </id> 10 <property name="password"></property><!-- 映射password属性 --> 11 </class> 12 </hibernate-mapping>
You can do anything you set your mind to, man!