From 60cfb7fb37a7ea950f0c56de1f95ebed9c6f7316 Mon Sep 17 00:00:00 2001 From: Mic Date: Tue, 5 Feb 2013 09:50:01 +0800 Subject: [PATCH] fixed JDBC bug --- .../petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java | 4 ++-- src/main/webapp/WEB-INF/web.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java index e5c88892e..04a8aea56 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java @@ -70,9 +70,9 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { @Transactional(readOnly = true) public Collection findByLastName(String lastName) throws DataAccessException { Map params = new HashMap(); - params.put("lastName", lastName); + params.put("lastName", lastName+"%"); List owners = this.namedParameterJdbcTemplate.query( - "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like :lastName%", + "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like :lastName", params, ParameterizedBeanPropertyRowMapper.newInstance(Owner.class) ); diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index bcf6a2a61..e1ea9935e 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -17,7 +17,7 @@ spring.profiles.active - jpa + jdbc