Browse Source

Polishing.

Avoiding var.
Referencing issue/pr in tests.
Formatting.

See #2125
See #1865
3.4.x
Jens Schauder 4 months ago
parent
commit
7fdffa3cf0
No known key found for this signature in database
GPG Key ID: 2BE5D185CD2A1CE6
  1. 6
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/query/PartTreeJdbcQueryUnitTests.java

6
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/query/PartTreeJdbcQueryUnitTests.java

@ -671,10 +671,11 @@ public class PartTreeJdbcQueryUnitTests {
.isEqualTo("SELECT COUNT(*) FROM " + TABLE + " WHERE " + TABLE + ".\"FIRST_NAME\" = :first_name"); .isEqualTo("SELECT COUNT(*) FROM " + TABLE + " WHERE " + TABLE + ".\"FIRST_NAME\" = :first_name");
} }
@Test @Test // GH-2125
public void mappingMapKeyToChildShouldNotResultInDuplicateColumn() throws Exception { public void mappingMapKeyToChildShouldNotResultInDuplicateColumn() throws Exception {
Method method = ParentRepository.class.getMethod("findByName", String.class); Method method = ParentRepository.class.getMethod("findByName", String.class);
var queryMethod = new JdbcQueryMethod(method, new DefaultRepositoryMetadata(ParentRepository.class), JdbcQueryMethod queryMethod = new JdbcQueryMethod(method, new DefaultRepositoryMetadata(ParentRepository.class),
new SpelAwareProxyProjectionFactory(), new PropertiesBasedNamedQueries(new Properties()), mappingContext); new SpelAwareProxyProjectionFactory(), new PropertiesBasedNamedQueries(new Properties()), mappingContext);
PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod); PartTreeJdbcQuery jdbcQuery = createQuery(queryMethod);
ParametrizedQuery query = jdbcQuery.createQuery(getAccessor(queryMethod, new Object[] { "John" }), returnedType); ParametrizedQuery query = jdbcQuery.createQuery(getAccessor(queryMethod, new Object[] { "John" }), returnedType);
@ -688,6 +689,7 @@ public class PartTreeJdbcQueryUnitTests {
} }
private JdbcQueryMethod getQueryMethod(String methodName, Class<?>... parameterTypes) throws Exception { private JdbcQueryMethod getQueryMethod(String methodName, Class<?>... parameterTypes) throws Exception {
Method method = UserRepository.class.getMethod(methodName, parameterTypes); Method method = UserRepository.class.getMethod(methodName, parameterTypes);
return new JdbcQueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class), return new JdbcQueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class),
new SpelAwareProxyProjectionFactory(), new PropertiesBasedNamedQueries(new Properties()), mappingContext); new SpelAwareProxyProjectionFactory(), new PropertiesBasedNamedQueries(new Properties()), mappingContext);

Loading…
Cancel
Save