DATAJPA-1163 - Polishing.

Reduced visibility of newly introduced method.
Moved method for test into inner class of the test

Original pull request: #283.
This commit is contained in:
Jens Schauder
2018-07-19 14:36:07 +02:00
parent 7348690594
commit d6263d6483
3 changed files with 6 additions and 6 deletions

View File

@@ -68,7 +68,7 @@ class ExpressionBasedStringQuery extends StringQuery {
* @param parser Parser for resolving SpEL expressions. Must not be {@literal null}.
* @return A query supporting SpEL expressions.
*/
public static ExpressionBasedStringQuery from(DeclaredQuery query, JpaEntityMetadata metadata,
static ExpressionBasedStringQuery from(DeclaredQuery query, JpaEntityMetadata metadata,
SpelExpressionParser parser) {
return new ExpressionBasedStringQuery(query.getQueryString(), metadata, parser);
}

View File

@@ -239,7 +239,7 @@ public class SimpleJpaQueryUnitTests {
when(em.createQuery(Mockito.anyString())).thenReturn(query);
Method method = UserRepository.class.getMethod("findAllWithExpressionInCountQuery", Pageable.class);
Method method = SampleRepository.class.getMethod("findAllWithExpressionInCountQuery", Pageable.class);
JpaQueryMethod queryMethod = new JpaQueryMethod(method, metadata, factory, extractor);
AbstractJpaQuery jpaQuery = new SimpleJpaQuery(queryMethod, em, "select u from User u", EVALUATION_CONTEXT_PROVIDER,
@@ -281,6 +281,10 @@ public class SimpleJpaQueryUnitTests {
@Query("select u from User u")
Collection<UserProjection> projectWithExplicitQuery();
@Query(value = "select u from #{#entityName} u", countQuery = "select count(u.id) from #{#entityName} u")
List<User> findAllWithExpressionInCountQuery(Pageable pageable);
}
interface UserProjection {}

View File

@@ -556,10 +556,6 @@ public interface UserRepository
// DATAJPA-1334
List<NameOnlyDto> findByNamedQueryWithConstructorExpression();
// DATAJPA-1163
@Query(value = "select u from #{#entityName} u", countQuery = "select count(u.id) from #{#entityName} u")
List<User> findAllWithExpressionInCountQuery(Pageable pageable);
interface RolesAndFirstname {
String getFirstname();