querydsl

Collections in QueryDSL projections

China☆狼群 提交于 2019-12-06 04:58:22
问题 I am trying to use a projection to pull in data from an entity an some relations it has. However. The constructor on the projection takes three arguments; a set, integer and another integer. This all works fine if I don't have the set in there as an argument, but as soon as I add the set, I start getting SQL syntax query errors. Here is an example of what I'm working with... @Entity public class Resource { private Long id; private String name; private String path; @ManyToOne @JoinColumn(name

Query DSL Q type classes not generated

左心房为你撑大大i 提交于 2019-12-06 02:10:30
I am trying to use QueryDSL in my eclipse maven project. These are the dependencies. <properties> <!-- The main class to start by executing java -jar --> <start-class>my.app.market.DBApp</start-class> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <querydsl.version>4.1.4</querydsl.version> <apt-maven-plugin.version>1.1.3</apt-maven-plugin.version> </properties> <dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-apt</artifactId> <version>4.1.4</version> <scope

How do you specify multi-column OrderSpecifier for use in SpringData and QueryDsl? Is this possible

家住魔仙堡 提交于 2019-12-06 01:23:39
问题 So I have the following query below: public Iterable<Dealer> findAll(Dealer dealer) { QDealer qdealer = QDealer.dealer; BooleanExpression where = null; if(dealer.getId() != null && dealer.getId() != 0) { buildPredicate(qdealer.id.goe(dealer.getId())); } OrderSpecifier<String> sortOrder = QDealer.dealer.dealerCode.desc(); Iterable<Dealer> results = dlrRpstry.findAll(where, sortOrder); return results; } The query above works fine. However, I would like to sort the results by dealerType first,

QueryDSL, java.lang.NoSuchMethodError: com.mysema.query.jpa.JPQLQuery.from([Lcom/mysema/query/types/EntityPath;)Lcom/mysema/query/jpa/JPQLCommonQuery;

孤街浪徒 提交于 2019-12-05 21:33:29
Trying to get Query Dsl (version 3.1.1) and Spring Data JPA (version 1.3.1.RELEASE) up and running.. My problem is with this error message ... java.lang.NoSuchMethodError: com.mysema.query.jpa.JPQLQuery.from([Lcom/mysema/query/types/EntityPath;)Lcom/mysema/query/jpa/JPQLCommonQuery; at org.springframework.data.jpa.repository.support.Querydsl.createQuery(Querydsl.java:88) at org.springframework.data.jpa.repository.support.QueryDslJpaRepository.createQuery(QueryDslJ paRepository.java:131) Seems to be like a version compatibility conflict. But what version of QueryDSL should I use for Spring Data

How to use order by and Limit in Spring Data JPA using QueryDSL

给你一囗甜甜゛ 提交于 2019-12-05 20:41:50
问题 I am using Spring Data JPA with a RDBMS in my project. I have a requirement where I have to fetch a single record from the Database from a table which has the latest date. For this I need to use a limit and order by function OR using sub queries. However, I wished to know if i wish for not to use NamedQuery is there a way I can achieve this using Spring Data JPA and QueryDSL. 回答1: Shouldn't QueryDslPredicateExecutor.findAll(Predicate predicate, Pageable pageable) do the trick for you? You

How to construct query in querydsl without domain classes

老子叫甜甜 提交于 2019-12-05 20:08:44
While looking for java libraries to build queries in a database agnostic way I came across many including iciql, querydsl, jooq, joist, hibernate etc. I wanted something that does not require configuration files and can work with dynamic schemas. For my application, I come to know about the database and the schema at runtime so I won't have any configuration files or domain classes for the schema. This seems to be one of the core goals of querydsl but going through the documentation for querydsl I see a lot of examples for building dynamic queries using domain classes but I have not come

Configure QueryDSL on Play 2 Framework

柔情痞子 提交于 2019-12-05 18:44:01
I try to configure QueryDSL in Play Framework (with Java) but without success. I've searched for similar problems in Google and this is what I found: 1. QueryDSL and Play . But this post establishing the equivalence with Lombok and the solution does not work for me. 2. Emulating MAVEN process . This is what I really need to apply it to other similar modules, but does not show an example of how. 3. Configure multiple modules . In this case includes several modules and is a bit confusing. So, how I could configure QueryDSL in Play? Anybody could include an example of how to do? Thanks in advance

How to make QueryDSL and Lombok work together

谁都会走 提交于 2019-12-05 18:23:48
问题 When a method or variable is annotated with Lombok annotation, the maven plugin will complain by processing the source generation for JPA. I get this kind of failure in the console logs: symbol: class __ location: class ServiceBaseMessage C:\workspaces\[...]\service\ServiceBaseMessage.java:44: error: cannot find symbol @Getter(onMethod = @__({ @JsonProperty("TYPE") })) How to make the apt-maven-plugin and queryDSL processor for JPA annotations work together with lombok annotations ? 回答1: This

QueryDSL Like operation on Number

不问归期 提交于 2019-12-05 17:34:34
I have to search a number-field with wildcards. The corresponding JQPL query would be like this: SELECT e From Entity e where e.personNumber LIKE :numberPattern numberPattern is a String like this: "1??2" and e.personNumber is a Number on the Database (H2). If i run this with JQPL it's no Problem at all but I can't put it into a queryDSL query. when I try to andBuilder.and(entity.personNumber.stringValue().like(numberPattern) I get a org.apache.openjpa.persistence.ArgumentException: "str (" bei Zeichen 7 gefunden, erwartet wurde jedoch ["(", "+", ... If i try to do it like this: Constant

Spring MongoDB + QueryDSL query by @DBRef related object

心不动则不痛 提交于 2019-12-05 16:51:16
I am using spring-data-mongodb and querydsl-mongodb to perform more flexible queries. My application has users and orders. An user can have multiple orders, so my models looks like this: public class User { @Id private String id; private String username; //getters and setters } public class Order { @Id private String id; @DBRef private User user; //getters and setters } As you can see, there is an has-many relationship between users and orders. Each order is assigned to an user, and the user is stored in @DBRef public User user attribute. Now, lets say that an user has 10,000 orders. How can i