@Override
public Time getEndTimeByDoctorIdDate(int doctorId, Date officeDate) {
Time endTime;
String sql = "SELECT end_time FROM doctor_time JOIN doctor ON doctor_time.doctor_id=doctor.doctor_id WHERE doctor.doctor_id = ? AND doctor_time.office_date = ?;" ;
try {
endTime = jdbcTemplate.queryForObject(sql, Time.class, doctorId, officeDate);
} catch (EmptyResultDataAccessException e) {
// Handle the case when no results are found
endTime = java.sql.Time.valueOf("7:00:00");
}
return endTime;
}
Doesn't seem to work? Can anyone help with why? I'm trying to pull a time in the format of "08:00:00" from postgres database.