@Override public StudentModel getCurrentStudent(StudentModel studentModel) { // TODO Auto-generated method stub /* * Retriving the newly entered student details. */ ResultSet myRes = null; try { Class.forName("com.mysql.jdbc.Driver"); Connection myCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnrollTrackDB", "root", ""); Statement myStmt = myCon.createStatement(); myRes = myStmt.executeQuery( "SELECT * FROM Gender,studentInformation,Ethnicity,School,CurrentGrade " + "where studentInformation.studentId = '" + studentModel.getStudentID() + "' AND " + "studentInformation.Ethnicity_ethnicityId = Ethnicity.ethnicityId AND " + "School.schoolId = studentInformation.School_schoolId AND " + "studentInformation.Gender_genderId = Gender.genderId AND " + "CurrentGrade.currentGradeId = studentInformation.CurrentGrade_currentGradeId"); while (myRes.next()) { studentModel.setStudentID( Integer.parseInt(myRes.getString("studentInformation.studentId"))); studentModel.setFirstName(myRes.getString("studentInformation.studentFirstName")); studentModel.setLastName(myRes.getString("studentInformation.studentLastName")); studentModel.setCurrentGPA(myRes.getInt("studentInformation.currentGPA")); studentModel.setCellNumber(myRes.getString("studentInformation.studentCellNumber")); studentModel.setHomePhone(myRes.getString("studentInformation.studentHomePhone")); studentModel.setDOB(myRes.getString("studentInformation.studentDOB")); studentModel.genderModel.setGenderName(myRes.getString("Gender.genderName")); studentModel.genderModel.setGenderID(myRes.getInt("Gender.genderId")); studentModel.ethnicityModel.setEthnicityName(myRes.getString("Ethnicity.ethnicityName")); studentModel.ethnicityModel.setEthnicityID(myRes.getInt("Ethnicity.ethnicityId")); studentModel.schoolModel.setSchoolName(myRes.getString("School.schoolName")); studentModel.schoolModel.setSchoolID(myRes.getInt("School.schoolId")); studentModel.gradeModel.setCurrentGrade(myRes.getString("CurrentGrade.currentGrade")); studentModel.gradeModel.setCurrentGradeId(myRes.getInt("CurrentGrade.currentGradeId")); } } catch (Exception e) { e.printStackTrace(); } return studentModel; }
@Override public StudentModel getDOB(AuthenticationModel authenticationModel) { // TODO Auto-generated method stub StudentModel studentModel = new StudentModel(); studentModel.setStudentEmailID(authenticationModel.getUserName()); ResultSet myRes = null; try { Class.forName("com.mysql.jdbc.Driver"); Connection myCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnrollTrackDB", "root", ""); Statement myStmt = myCon.createStatement(); myRes = myStmt.executeQuery( "SELECT `studentDOB` from studentInformation where studentEmail='" + studentModel.getStudentEmailID() + "'"); while (myRes.next()) { studentModel.setDOB(myRes.getString("studentDOB")); } } catch (Exception e) { e.printStackTrace(); } return studentModel; }