Skip to content

Commit 7f6a609

Browse files
committed
DATADOC-115 - Upgraded to Querydsl 2.2.0-beta4.
Enabled treatment of not annotated classes as embedded documents to let Querydsl create query classes for them. Annotated BasePerson with @QuerySupertype as Querydsl seems to need this annotation to create the query class for super types in the 2.2 branch. That issue is tracked in https://bugs.launchpad.net/querydsl/+bug/776219 so that we should be able to remove the annotation as soon as this one is fixed.
1 parent 68f8bd6 commit 7f6a609

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

spring-data-mongodb/pom.xml

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<properties>
1616
<mongo.version>2.4</mongo.version>
17+
<querydsl.version>2.2.0-beta4</querydsl.version>
1718
</properties>
1819

1920
<dependencies>
@@ -65,7 +66,7 @@
6566
<dependency>
6667
<groupId>com.mysema.querydsl</groupId>
6768
<artifactId>querydsl-mongodb</artifactId>
68-
<version>2.1.1</version>
69+
<version>${querydsl.version}</version>
6970
<optional>true</optional>
7071
<exclusions>
7172
<exclusion>
@@ -78,7 +79,7 @@
7879
<dependency>
7980
<groupId>com.mysema.querydsl</groupId>
8081
<artifactId>querydsl-apt</artifactId>
81-
<version>2.1.1</version>
82+
<version>${querydsl.version}</version>
8283
<scope>provided</scope>
8384
</dependency>
8485

@@ -161,15 +162,15 @@
161162
<plugin>
162163
<groupId>com.mysema.maven</groupId>
163164
<artifactId>maven-apt-plugin</artifactId>
164-
<version>1.0</version>
165+
<version>1.0.1</version>
165166
<executions>
166167
<execution>
167168
<phase>generate-test-sources</phase>
168169
<goals>
169170
<goal>test-process</goal>
170171
</goals>
171172
<configuration>
172-
<outputDirectory>target/generated-sources/test-annotations</outputDirectory>
173+
<outputDirectory>target/generated-test-sources</outputDirectory>
173174
<processor>org.springframework.data.document.mongodb.repository.MongoAnnotationProcessor</processor>
174175
</configuration>
175176
</execution>

spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/MongoAnnotationProcessor.java

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
5656
DefaultConfiguration configuration = new DefaultConfiguration(roundEnv, processingEnv.getOptions(),
5757
Collections.<String> emptySet(), QueryEntities.class, Document.class, QuerySupertype.class,
5858
QueryEmbeddable.class, QueryEmbedded.class, QueryTransient.class);
59+
configuration.setUnknownAsEmbedded(true);
5960

6061
Processor processor = new Processor(processingEnv, roundEnv, configuration);
6162
processor.process();

spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/mapping/BasePerson.java

+7
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@
1616

1717
package org.springframework.data.document.mongodb.mapping;
1818

19+
import com.mysema.query.annotations.QuerySupertype;
20+
1921
/**
22+
* {@link QuerySupertype} is necessary for Querydsl 2.2.0-beta4 to compile the query classes directly. Can be removed as
23+
* soon as {@link https://bugs.launchpad.net/querydsl/+bug/776219} is fixed.
24+
*
25+
* @see https://bugs.launchpad.net/querydsl/+bug/776219
2026
* @author Jon Brisbin <jbrisbin@vmware.com>
2127
*/
28+
@QuerySupertype
2229
public abstract class BasePerson {
2330

2431
protected Integer ssn;

0 commit comments

Comments
 (0)