DATAJPA-78 - Upgrade to Querydsl 2.2.0.
Upgraded to Querydsl 2.2.0. Added configuration to generate query classes for AbstractPersistable and AbstractAuditable. Package those query classes into the source JAR and compile it into the binary as well. Upgraded Mysema APT plugin to 1.0.2.
This commit is contained in:
32
pom.xml
32
pom.xml
@@ -58,7 +58,7 @@
|
||||
<openjpa.version>2.1.0</openjpa.version>
|
||||
<eclipselink.version>2.2.0</eclipselink.version>
|
||||
<aspectj.version>1.6.8</aspectj.version>
|
||||
<querydsl.version>2.1.1</querydsl.version>
|
||||
<querydsl.version>2.2.0</querydsl.version>
|
||||
<junit.version>4.8.1</junit.version>
|
||||
<jpa.version>2.0.0</jpa.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
@@ -508,6 +508,12 @@
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>src/main/java</include>
|
||||
<include>target/generated-sources/main</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
@@ -532,16 +538,34 @@
|
||||
<plugin>
|
||||
<groupId>com.mysema.maven</groupId>
|
||||
<artifactId>maven-apt-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.0.2</version>
|
||||
<configuration>
|
||||
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>process</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target/generated-sources/main</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>test-process</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target/generated-sources/test-annotations</outputDirectory>
|
||||
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
|
||||
<outputDirectory>target/generated-sources/test</outputDirectory>
|
||||
<options>
|
||||
<querydsl.excludedClasses>
|
||||
org.springframework.data.jpa.repository.util.JpaClassUtilsUnitTests.NamedUser,org.springframework.data.jpa.repository.query.ParameterBinderUnitTests.SampleEmbeddable
|
||||
</querydsl.excludedClasses>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -47,6 +47,9 @@ import com.mysema.query.types.path.PathBuilder;
|
||||
public class QueryDslJpaRepository<T, ID extends Serializable> extends
|
||||
SimpleJpaRepository<T, ID> implements QueryDslPredicateExecutor<T> {
|
||||
|
||||
private static final EntityPathResolver DEFAULT_ENTITY_PATH_RESOLVER =
|
||||
SimpleEntityPathResolver.INSTANCE;
|
||||
|
||||
private final EntityManager em;
|
||||
private final EntityPath<T> path;
|
||||
private final PathBuilder<T> builder;
|
||||
@@ -64,7 +67,7 @@ public class QueryDslJpaRepository<T, ID extends Serializable> extends
|
||||
public QueryDslJpaRepository(JpaEntityInformation<T, ID> entityMetadata,
|
||||
EntityManager entityManager) {
|
||||
|
||||
this(entityMetadata, entityManager, SimpleEntityPathResolver.INSTANCE);
|
||||
this(entityMetadata, entityManager, DEFAULT_ENTITY_PATH_RESOLVER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ public class ParameterBinderUnitTests {
|
||||
|
||||
@Embeddable
|
||||
@SuppressWarnings("unused")
|
||||
static class SampleEmbeddable {
|
||||
public static class SampleEmbeddable {
|
||||
|
||||
private String foo;
|
||||
private String bar;
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.repository.support;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@@ -159,10 +160,16 @@ public class JpaRepositoryFactoryUnitTests {
|
||||
factory.getRepositoryBaseClass(new DefaultRepositoryMetadata(
|
||||
QueryDslSampleRepository.class)));
|
||||
|
||||
QueryDslSampleRepository repository =
|
||||
factory.getRepository(QueryDslSampleRepository.class);
|
||||
assertEquals(QueryDslJpaRepository.class,
|
||||
((Advised) repository).getTargetClass());
|
||||
try {
|
||||
QueryDslSampleRepository repository =
|
||||
factory.getRepository(QueryDslSampleRepository.class);
|
||||
assertEquals(QueryDslJpaRepository.class,
|
||||
((Advised) repository).getTargetClass());
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(
|
||||
e.getStackTrace()[0].getClassName(),
|
||||
is("org.springframework.data.querydsl.SimpleEntityPathResolver"));
|
||||
}
|
||||
}
|
||||
|
||||
private interface SimpleSampleRepository extends
|
||||
|
||||
@@ -40,7 +40,7 @@ public class JpaClassUtilsUnitTests {
|
||||
}
|
||||
|
||||
@Entity(name = "AnotherNamedUser")
|
||||
public static class NamedUser {
|
||||
public class NamedUser {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user