Skip to content

Commit f8d03a4

Browse files
committed
Documentation
1 parent ef17ae9 commit f8d03a4

18 files changed

+810
-782
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/JpaSpecificationExecutor.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,17 @@
1515
*/
1616
package org.springframework.data.jpa.repository;
1717

18-
import jakarta.persistence.criteria.CriteriaBuilder;
19-
import jakarta.persistence.criteria.CriteriaQuery;
20-
import jakarta.persistence.criteria.Root;
21-
22-
import java.util.Arrays;
23-
import java.util.Collection;
2418
import java.util.Arrays;
2519
import java.util.Collection;
2620
import java.util.List;
2721
import java.util.Optional;
2822
import java.util.function.Function;
2923

30-
import org.springframework.dao.InvalidDataAccessApiUsageException;
3124
import org.jspecify.annotations.Nullable;
3225

3326
import org.springframework.dao.InvalidDataAccessApiUsageException;
34-
35-
import org.jspecify.annotations.Nullable;
3627
import org.springframework.data.domain.Page;
3728
import org.springframework.data.domain.Pageable;
38-
import org.springframework.data.domain.Slice;
3929
import org.springframework.data.domain.Sort;
4030
import org.springframework.data.jpa.domain.DeleteSpecification;
4131
import org.springframework.data.jpa.domain.PredicateSpecification;
@@ -115,7 +105,6 @@ default List<T> findAll(PredicateSpecification<T> spec) {
115105
* Returns a {@link Page} of entities matching the given {@link Specification}.
116106
* <p>
117107
* Supports counting the total number of entities matching the {@link Specification}.
118-
* <p>
119108
*
120109
* @param spec can be {@literal null}, if no {@link Specification} is given all entities matching {@code <T>} will be
121110
* selected.

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/NativeQuery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,5 @@
9494
* Name of the {@link jakarta.persistence.SqlResultSetMapping @SqlResultSetMapping(name)} to apply for this query.
9595
*/
9696
String sqlResultSetMapping() default "";
97+
9798
}

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/Query.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@
9090
* @since 3.0
9191
*/
9292
Class<? extends QueryRewriter> queryRewriter() default QueryRewriter.IdentityQueryRewriter.class;
93+
9394
}

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/AbstractStringBasedJpaQuery.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
abstract class AbstractStringBasedJpaQuery extends AbstractJpaQuery {
5050

5151
private final EntityQuery query;
52-
private final Lazy<StructuredQuery> countQuery;
52+
private final Lazy<ParametrizedQuery> countQuery;
5353
private final ValueExpressionDelegate valueExpressionDelegate;
5454
private final QueryRewriter queryRewriter;
5555
private final QuerySortRewriter querySortRewriter;
@@ -151,7 +151,7 @@ protected ParameterBinder createBinder() {
151151
return createBinder(query);
152152
}
153153

154-
protected ParameterBinder createBinder(StructuredQuery query) {
154+
protected ParameterBinder createBinder(ParametrizedQuery query) {
155155
return ParameterBinderFactory.createQueryAwareBinder(getQueryMethod().getParameters(), query,
156156
valueExpressionDelegate, valueExpressionContextProvider);
157157
}
@@ -182,7 +182,7 @@ public EntityQuery getQuery() {
182182
/**
183183
* @return the countQuery
184184
*/
185-
public StructuredQuery getCountQuery() {
185+
public ParametrizedQuery getCountQuery() {
186186
return countQuery.get();
187187
}
188188

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/DefaultEntityQuery.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* Encapsulation of a JPA query string, typically returning entities or DTOs. Provides access to parameter bindings.
2424
* <p>
25-
* The internal {@link ParametrizedQuery query string} is cleaned from decorated parameters like {@literal %:lastname%}
25+
* The internal {@link PreprocessedQuery query string} is cleaned from decorated parameters like {@literal %:lastname%}
2626
* and the matching bindings take care of applying the decorations in the {@link ParameterBinding#prepare(Object)}
2727
* method. Note that this class also handles replacing SpEL expressions with synthetic bind parameters.
2828
*
@@ -38,10 +38,10 @@
3838
*/
3939
class DefaultEntityQuery implements EntityQuery, DeclaredQuery {
4040

41-
private final ParametrizedQuery query;
41+
private final PreprocessedQuery query;
4242
private final QueryEnhancer queryEnhancer;
4343

44-
DefaultEntityQuery(ParametrizedQuery query, QueryEnhancerFactory queryEnhancerFactory) {
44+
DefaultEntityQuery(PreprocessedQuery query, QueryEnhancerFactory queryEnhancerFactory) {
4545
this.query = query;
4646
this.queryEnhancer = queryEnhancerFactory.create(query);
4747
}
@@ -89,22 +89,23 @@ public boolean isDefaultProjection() {
8989
return queryEnhancer.getProjection().equalsIgnoreCase(getAlias());
9090
}
9191

92+
@Nullable
93+
String getAlias() {
94+
return queryEnhancer.detectAlias();
95+
}
96+
9297
@Override
9398
public boolean usesPaging() {
9499
return query.containsPageableInSpel();
95100
}
96101

97-
public @Nullable String getAlias() {
98-
return queryEnhancer.detectAlias();
99-
}
100-
101102
String getProjection() {
102103
return this.queryEnhancer.getProjection();
103104
}
104105

105106
@Override
106-
public StructuredQuery deriveCountQuery(@Nullable String countQueryProjection) {
107-
return new SimpleStructuredQuery(this.query.rewrite(queryEnhancer.createCountQueryFor(countQueryProjection)));
107+
public ParametrizedQuery deriveCountQuery(@Nullable String countQueryProjection) {
108+
return new SimpleParametrizedQuery(this.query.rewrite(queryEnhancer.createCountQueryFor(countQueryProjection)));
108109
}
109110

110111
@Override
@@ -118,13 +119,13 @@ public String toString() {
118119
}
119120

120121
/**
121-
* Simple {@link StructuredQuery} variant forwarding to {@link ParametrizedQuery}.
122+
* Simple {@link ParametrizedQuery} variant forwarding to {@link PreprocessedQuery}.
122123
*/
123-
static class SimpleStructuredQuery implements StructuredQuery {
124+
static class SimpleParametrizedQuery implements ParametrizedQuery {
124125

125-
private final ParametrizedQuery query;
126+
private final PreprocessedQuery query;
126127

127-
SimpleStructuredQuery(ParametrizedQuery query) {
128+
SimpleParametrizedQuery(PreprocessedQuery query) {
128129
this.query = query;
129130
}
130131

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EmptyIntrospectedQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.jspecify.annotations.Nullable;
2222

2323
/**
24-
* NULL-Object pattern implementation for {@link StructuredQuery}.
24+
* NULL-Object pattern implementation for {@link ParametrizedQuery}.
2525
*
2626
* @author Jens Schauder
2727
* @author Mark Paluch
@@ -73,7 +73,7 @@ public String getQueryString() {
7373
}
7474

7575
@Override
76-
public StructuredQuery deriveCountQuery(@Nullable String countQueryProjection) {
76+
public ParametrizedQuery deriveCountQuery(@Nullable String countQueryProjection) {
7777
return INSTANCE;
7878
}
7979

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/EntityQuery.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.jspecify.annotations.Nullable;
1919

2020
/**
21-
* An extension to {@link StructuredQuery} exposing query information about its inner structure such as whether
21+
* An extension to {@link ParametrizedQuery} exposing query information about its inner structure such as whether
2222
* constructor expressions (JPQL) are used or the default projection is used.
2323
* <p>
2424
* Entity Queries support derivation of {@link #deriveCountQuery(String) count queries} from the original query. They
@@ -28,7 +28,7 @@
2828
* @author Diego Krupitza
2929
* @since 4.0
3030
*/
31-
interface EntityQuery extends StructuredQuery {
31+
interface EntityQuery extends ParametrizedQuery {
3232

3333
/**
3434
* Create a new {@link EntityQuery} given {@link DeclaredQuery} and {@link QueryEnhancerSelector}.
@@ -39,7 +39,7 @@ interface EntityQuery extends StructuredQuery {
3939
*/
4040
static EntityQuery create(DeclaredQuery query, QueryEnhancerSelector selector) {
4141

42-
ParametrizedQuery preparsed = ParametrizedQuery.parse(query);
42+
PreprocessedQuery preparsed = PreprocessedQuery.parse(query);
4343
QueryEnhancerFactory enhancerFactory = selector.select(preparsed);
4444

4545
return new DefaultEntityQuery(preparsed, enhancerFactory);
@@ -73,7 +73,7 @@ default boolean usesPaging() {
7373
* @param countQueryProjection an optional return type for the query.
7474
* @return a new {@literal IntrospectedQuery} instance.
7575
*/
76-
StructuredQuery deriveCountQuery(@Nullable String countQueryProjection);
76+
ParametrizedQuery deriveCountQuery(@Nullable String countQueryProjection);
7777

7878
/**
7979
* Rewrite the query using the given

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryEnhancer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static void configureParser(String query, String grammar, Lexer lexer, Parser pa
140140
}
141141

142142
/**
143-
* Factory method to create a {@link JpaQueryEnhancer} for {@link StructuredQuery} using JPQL grammar.
143+
* Factory method to create a {@link JpaQueryEnhancer} for {@link ParametrizedQuery} using JPQL grammar.
144144
*
145145
* @param query must not be {@literal null}.
146146
* @return a new {@link JpaQueryEnhancer} using JPQL.
@@ -150,7 +150,7 @@ public static JpaQueryEnhancer<QueryInformation> forJpql(String query) {
150150
}
151151

152152
/**
153-
* Factory method to create a {@link JpaQueryEnhancer} for {@link StructuredQuery} using HQL grammar.
153+
* Factory method to create a {@link JpaQueryEnhancer} for {@link ParametrizedQuery} using HQL grammar.
154154
*
155155
* @param query must not be {@literal null}.
156156
* @return a new {@link JpaQueryEnhancer} using HQL.
@@ -160,7 +160,7 @@ public static JpaQueryEnhancer<HibernateQueryInformation> forHql(String query) {
160160
}
161161

162162
/**
163-
* Factory method to create a {@link JpaQueryEnhancer} for {@link StructuredQuery} using EQL grammar.
163+
* Factory method to create a {@link JpaQueryEnhancer} for {@link ParametrizedQuery} using EQL grammar.
164164
*
165165
* @param query must not be {@literal null}.
166166
* @return a new {@link JpaQueryEnhancer} using EQL.

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/ParameterBinderFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static ParameterBinder createBinder(JpaParameters parameters, List<ParameterBind
8484
* @return a {@link ParameterBinder} that can assign values for the method parameters to query parameters of a
8585
* {@link jakarta.persistence.Query} while processing SpEL expressions where applicable.
8686
*/
87-
static ParameterBinder createQueryAwareBinder(JpaParameters parameters, StructuredQuery query,
87+
static ParameterBinder createQueryAwareBinder(JpaParameters parameters, ParametrizedQuery query,
8888
ValueExpressionParser parser, ValueEvaluationContextProvider evaluationContextProvider) {
8989

9090
Assert.notNull(parameters, "JpaParameters must not be null");
@@ -130,7 +130,7 @@ private static Iterable<QueryParameterSetter> createSetters(List<ParameterBindin
130130
}
131131

132132
private static Iterable<QueryParameterSetter> createSetters(List<ParameterBinding> parameterBindings,
133-
StructuredQuery query, QueryParameterSetterFactory... strategies) {
133+
ParametrizedQuery query, QueryParameterSetterFactory... strategies) {
134134

135135
List<QueryParameterSetter> setters = new ArrayList<>(parameterBindings.size());
136136
for (ParameterBinding parameterBinding : parameterBindings) {
@@ -141,7 +141,7 @@ private static Iterable<QueryParameterSetter> createSetters(List<ParameterBindin
141141
}
142142

143143
private static QueryParameterSetter createQueryParameterSetter(ParameterBinding binding,
144-
QueryParameterSetterFactory[] strategies, StructuredQuery query) {
144+
QueryParameterSetterFactory[] strategies, ParametrizedQuery query) {
145145

146146
for (QueryParameterSetterFactory strategy : strategies) {
147147

0 commit comments

Comments
 (0)