Skip to content
Snippets Groups Projects
Commit 60cfb7fb authored by Mic's avatar Mic
Browse files

fixed JDBC bug

parent ae9085de
No related branches found
No related tags found
No related merge requests found
...@@ -70,9 +70,9 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { ...@@ -70,9 +70,9 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository {
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Collection<Owner> findByLastName(String lastName) throws DataAccessException { public Collection<Owner> findByLastName(String lastName) throws DataAccessException {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("lastName", lastName); params.put("lastName", lastName+"%");
List<Owner> owners = this.namedParameterJdbcTemplate.query( 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, params,
ParameterizedBeanPropertyRowMapper.newInstance(Owner.class) ParameterizedBeanPropertyRowMapper.newInstance(Owner.class)
); );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<context-param> <context-param>
<param-name>spring.profiles.active</param-name> <param-name>spring.profiles.active</param-name>
<param-value>jpa</param-value> <param-value>jdbc</param-value>
<!-- you can replace the above param with: <!-- you can replace the above param with:
<param-value>jdbc</param-value> <param-value>jdbc</param-value>
<param-value>jpa</param-value> (in the case of plain JPA) <param-value>jpa</param-value> (in the case of plain JPA)
......
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