mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-28 13:59:37 +00:00
fixed JDBC bug
This commit is contained in:
parent
ae9085de62
commit
60cfb7fb37
2 changed files with 3 additions and 3 deletions
|
@ -70,9 +70,9 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository {
|
|||
@Transactional(readOnly = true)
|
||||
public Collection<Owner> findByLastName(String lastName) throws DataAccessException {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("lastName", lastName);
|
||||
params.put("lastName", lastName+"%");
|
||||
List<Owner> 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)
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<context-param>
|
||||
<param-name>spring.profiles.active</param-name>
|
||||
<param-value>jpa</param-value>
|
||||
<param-value>jdbc</param-value>
|
||||
<!-- you can replace the above param with:
|
||||
<param-value>jdbc</param-value>
|
||||
<param-value>jpa</param-value> (in the case of plain JPA)
|
||||
|
|
Loading…
Reference in a new issue