Skip to content
Snippets Groups Projects
Commit 91d19d17 authored by Antoine Rey's avatar Antoine Rey
Browse files

#92 Fix column 'visits.id' not found on MySql

parent 39ab8361
No related branches found
No related tags found
No related merge requests found
...@@ -81,7 +81,7 @@ public class JdbcVisitRepositoryImpl implements VisitRepository { ...@@ -81,7 +81,7 @@ public class JdbcVisitRepositoryImpl implements VisitRepository {
@Override @Override
public List<Visit> findByPetId(Integer petId) { public List<Visit> findByPetId(Integer petId) {
return this.jdbcTemplate.query( return this.jdbcTemplate.query(
"SELECT id as visit_id, visit_date, description FROM visits WHERE pet_id=?", "SELECT id, visit_date, description FROM visits WHERE pet_id=?",
new JdbcVisitRowMapper(), petId); new JdbcVisitRowMapper(), petId);
} }
......
...@@ -33,7 +33,7 @@ class JdbcVisitRowMapper implements RowMapper<Visit> { ...@@ -33,7 +33,7 @@ class JdbcVisitRowMapper implements RowMapper<Visit> {
@Override @Override
public Visit mapRow(ResultSet rs, int row) throws SQLException { public Visit mapRow(ResultSet rs, int row) throws SQLException {
Visit visit = new Visit(); Visit visit = new Visit();
visit.setId(rs.getInt("visits.id")); visit.setId(rs.getInt("id"));
Date visitDate = rs.getDate("visit_date"); Date visitDate = rs.getDate("visit_date");
visit.setDate(new DateTime(visitDate)); visit.setDate(new DateTime(visitDate));
visit.setDescription(rs.getString("description")); visit.setDescription(rs.getString("description"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment