Created
June 13, 2018 14:10
-
-
Save sapanparikh18/c1272b8b9d3d2f500e9f9caa06320da2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Reviewanswer getAnswer(int questionId) throws DataNotFoundException { | |
String sql = "select * from answers where questionid=:questionId"; | |
Map<String, Object> params = new HashMap<>(); | |
params.put("questionId",questionId); | |
Reviewanswer answer = new Reviewanswer(); | |
try { | |
answer = namedParameterJdbcTemplate.queryForObject(sql,params,Reviewanswer.class); | |
}catch (DataAccessException ex){ | |
if("data not found(or something on similar lines)".equals(ex.getMessage())){ | |
throw new DataNotFoundException(); | |
} | |
} | |
return answer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment