I want to make a filterable list of my UserTask entity with the QueryDslPredicateExecutor interface, so the parameters given in the query string will be autoprocessed into a Predicate.
I have the following classes/interfaces
public interface UserTaskQuerydslRepository extends CrudRepository<UserTask, String>, QueryDslPredicateExecutor<UserTask>, QuerydslBinderCustomizer<QUserTask> { @Override default void customize(QuerydslBindings bindings, QUserTask userTask) { ... } }
UserTask is my class that represents the (couchbase) model
@QueryEntity @Document(expiry = 0) public class UserTask { @Id private String id; ... }
If i annotate this class with @QueryEntity then Maven generates the QUserTask class for me
@Generated("com.mysema.query.codegen.EntitySerializer") public class QUserTask extends EntityPathBase<UserTask> { private static final long serialVersionUID = 493434469L; public static final QUserTask userTask = new QUserTask("userTask"); public final StringPath id = createString("id"); ... public QUserTask(String variable) { super(UserTask.class, forVariable(variable)); } public QUserTask(Path<? extends UserTask> path) { super(path.getType(), path.getMetadata()); } public QUserTask(PathMetadata<?> metadata) { super(UserTask.class, metadata); } }
To generate QUserTask i added the following lines to pom.xml
<plugin> <groupId>com.mysema.maven</groupId> <artifactId>apt-maven-plugin</artifactId> <version>1.1.3</version> <executions> <execution> <goals> <goal>process</goal> </goals> <configuration> <outputDirectory>target/generated-sources/apt</outputDirectory> <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor> <processor>com.mysema.query.apt.QuerydslAnnotationProcessor</processor> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>com.mysema.querydsl</groupId> <artifactId>querydsl-apt</artifactId> <version>3.4.3</version> </dependency> </dependencies> </plugin>
In the project we have both JPA entities and couchbase entities, that's why i have the JPAAnnotationProcessor there.
If i run the application like this i get the following error:
org.springframework.data.mapping.PropertyReferenceException: No property findAll found for type UserTask!
I tried to annotate my UserTaskQuerydslRepository with @NoRepositoryBean, it solved my findAll problem, but when i tries to @Inject this repository to a Resource (or controller, JHipster calls it Resource) i get the following error
No qualifying bean of type [.UserTaskQuerydslRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
Can anyone help me what did I do wrong?