@Override
    public List<Visit> findByPetId(Integer petId) {
        JdbcPet pet = this.jdbcClient
            .sql("SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=:id")
            .param("id", petId)
            .query(new JdbcPetRowMapper())
            .single();

        List<Visit> visits = this.jdbcClient
            .sql("SELECT id as visit_id, visit_date, description FROM visits WHERE pet_id=:id")
            .param("id", petId)
            .query(new JdbcVisitRowMapper())
            .list();

        for (Visit visit: visits) {
            visit.setPet(pet);
        }

        return visits;
    }
Creates a {@link MapSqlParameterSource} based on data values from the supplied {@link Visit} instance.
src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRepositoryImpl.java