mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-29 22:59:38 +00:00
#92 Fix column 'visits.id' not found on MySql
This commit is contained in:
parent
39ab8361d4
commit
91d19d17b8
2 changed files with 2 additions and 2 deletions
|
@ -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> {
|
||||||
@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"));
|
||||||
|
|
Loading…
Reference in a new issue