Skip to content

Commit 986ea39

Browse files
mp911dechristophstrobl
authored andcommitted
Upgrade to Querydsl 5.0.
Move off our own Querydsl copies, as Querydsl 5.0 ships MongoDB Document API support. Remove package-private duplicates of Querydsl code. Introduce SpringDataMongodbQuerySupport to provide a well-formatted toString representation of the actual query. Original Pull Request: #3674
1 parent 5bd7ff1 commit 986ea39

11 files changed

+383
-923
lines changed

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/MongodbDocumentSerializer.java

-459
This file was deleted.

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/QuerydslAbstractMongodbQuery.java

+8-24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import com.querydsl.core.types.OrderSpecifier;
3535
import com.querydsl.core.types.ParamExpression;
3636
import com.querydsl.core.types.Predicate;
37+
import com.querydsl.mongodb.document.AbstractMongodbQuery;
38+
import com.querydsl.mongodb.document.MongodbDocumentSerializer;
3739

3840
/**
3941
* {@code QuerydslAbstractMongodbQuery} provides a base class for general Querydsl query implementation.
@@ -49,8 +51,12 @@
4951
* @author Mark Paluch
5052
* @author Christoph Strobl
5153
* @since 2.1
54+
* @deprecated since 3.3, use Querydsl's {@link AbstractMongodbQuery} directly. This class is deprecated for removal
55+
* with the next major release.
5256
*/
57+
@Deprecated
5358
public abstract class QuerydslAbstractMongodbQuery<K, Q extends QuerydslAbstractMongodbQuery<K, Q>>
59+
extends AbstractMongodbQuery<Q>
5460
implements SimpleQuery<Q> {
5561

5662
private static final JsonWriterSettings JSON_WRITER_SETTINGS = JsonWriterSettings.builder().outputMode(JsonMode.SHELL)
@@ -67,6 +73,8 @@ public abstract class QuerydslAbstractMongodbQuery<K, Q extends QuerydslAbstract
6773
@SuppressWarnings("unchecked")
6874
QuerydslAbstractMongodbQuery(MongodbDocumentSerializer serializer) {
6975

76+
super(serializer);
77+
7078
this.queryMixin = new QueryMixin<>((Q) this, new DefaultQueryMetadata(), false);
7179
this.serializer = serializer;
7280
}
@@ -158,22 +166,6 @@ protected Document createProjection(@Nullable Expression<?> projectionExpression
158166
return projection;
159167
}
160168

161-
/**
162-
* Compute the filer {@link Document} from the given {@link Predicate}.
163-
*
164-
* @param predicate can be {@literal null}.
165-
* @return an empty {@link Document} if predicate is {@literal null}.
166-
* @see MongodbDocumentSerializer#toQuery(Predicate)
167-
*/
168-
protected Document createQuery(@Nullable Predicate predicate) {
169-
170-
if (predicate == null) {
171-
return new Document();
172-
}
173-
174-
return serializer.toQuery(predicate);
175-
}
176-
177169
/**
178170
* Compute the sort {@link Document} from the given list of {@link OrderSpecifier order specifiers}.
179171
*
@@ -194,14 +186,6 @@ QueryMixin<Q> getQueryMixin() {
194186
return queryMixin;
195187
}
196188

197-
/**
198-
* Get the where definition as a Document instance
199-
*
200-
* @return
201-
*/
202-
Document asDocument() {
203-
return createQuery(queryMixin.getMetadata().getWhere());
204-
}
205189

206190
/**
207191
* Returns the {@literal Mongo Shell} representation of the query. <br />

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/QuerydslAnyEmbeddedBuilder.java

+3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
* @author Mark Paluch
3838
* @author Christoph Strobl
3939
* @since 2.1
40+
* @deprecated since 3.3, use Querydsl's {@link com.querydsl.mongodb.document.AnyEmbeddedBuilder} directly. This class
41+
* is deprecated for removal with the next major release.
4042
*/
43+
@Deprecated
4144
public class QuerydslAnyEmbeddedBuilder<Q extends QuerydslAbstractMongodbQuery<K, Q>, K> {
4245

4346
private final QueryMixin<Q> queryMixin;

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/QuerydslFetchableMongodbQuery.java

-272
This file was deleted.

0 commit comments

Comments
 (0)