private void setValues(PreparedStatement ps, OfficeVisitBean ov) throws SQLException { ps.setDate(1, new java.sql.Date(ov.getVisitDate().getTime())); ps.setString(2, ov.getNotes()); ps.setLong(3, ov.getHcpID()); ps.setLong(4, ov.getPatientID()); ps.setString(5, ov.getHospitalID()); }
public void testUpdateNewOfficeVisit() { try { OfficeVisitBean ov = new OfficeVisitBean(); long newOVID = ovDAO.add(ov); ov = new OfficeVisitBean(newOVID); ov.setNotes("some notes"); ov.setVisitDateStr("07/07/2007"); ov.setPatientID(65); ov.setHcpID(5); ov.setHospitalID("9191919191"); ovDAO.update(ov); ov = ovDAO.getOfficeVisit(newOVID); assertEquals("some notes", ov.getNotes()); assertEquals("07/07/2007", new SimpleDateFormat("MM/dd/yyyy").format(ov.getVisitDate())); assertEquals(65, ov.getPatientID()); assertEquals(5, ov.getHcpID()); assertEquals("9191919191", ov.getHospitalID()); } catch (Exception e) { e.printStackTrace(); } }