Questions tagged [querydsl]

Querydsl is a framework which enables the construction of type-safe SQL-like queries for multiple backends including JPA, MongoDB and SQL in Java.

Querydsl is a framework which enables the construction of type-safe SQL-like queries for multiple backends including , and in .

Instead of writing queries as inline strings or externalizing them into XML files they are constructed via a fluent API.

1985 questions
12
votes
3 answers

Replacing deprecated QuerydslJpaRepository with QuerydslJpaPredicateExecutor fails

I needed some custom QueryDSL enabled query methods and followed this SO answer. That worked great, but after upgrading to Spring Boot 2.1 (which upgrades Spring Data), I've found that QuerydslJpaRepository has been deprecated. Simply replacing it…
Benjamin Maurer
  • 3,602
  • 5
  • 28
  • 49
12
votes
1 answer

How to filter with multiple fields and values in elasticsearch?

I've been reading through the docs and been trying to achieve a solution to filter results through multiple fields and columns, however I keep getting errors; malformed query. I want to filter the result with exact equal values, such as the…
Kilise
  • 1,051
  • 4
  • 15
  • 35
12
votes
1 answer

Spring Data Mongodb: How to Dump Raw Query/Commands generated through QueryDsl?

I'm using Spring Data's Querydsl integration to execute my queries using predicates. findAll(predicate, pageable) Is there a way to dump the actual raw queries/commands that get executed? I have also looked at the answer to this question and it…
user1955934
  • 3,185
  • 5
  • 42
  • 68
12
votes
2 answers

How can I dynamically add where clauses with querydsl?

I've been looking for some time now on the documentation and tried several things but I was not able to dynamically add where clauses with querydsl: Pseudocode, I need something like the "if": boolean addWhereClause = false; QAddress address =…
soilworker
  • 1,317
  • 1
  • 15
  • 32
12
votes
3 answers

Spring Data + QueryDSL empty predicate + Predicate chaining

let me get straight to the point. I am using Spring Data JPA with QueryDSL in a project and I cannot figure out this myself. I have the QueryDSL predicates in static methods that can take arguments and if the argument is not correct it should return…
user1622058
  • 453
  • 3
  • 7
  • 16
12
votes
2 answers

What exactly does type-safe queries means?

While going through JPA, QueryDSL they all have included the concept of type-safe queries. But what exactly is it? According to blogs/articles, I guess it is a feature of JPA/QueryDSL that validates their parameter type while making queries. And any…
Mani Rai
  • 665
  • 2
  • 9
  • 22
12
votes
2 answers

QueryDSL, spring-boot & Gradle

I was hoping to bring querydsl into my spring-boot project via gradle. Despite finding a couple of examples online, none of them actually work for me because of issues with dependencies (I think). According to the QueryDSL support forum, gradle is…
sonoerin
  • 5,015
  • 23
  • 75
  • 132
12
votes
3 answers

Spring Data JPA and spring-security: filter on database level (especially for paging)

I'm trying to add method level security to my open source project using annotations and spring-security. The problem I'm now facing are findAll methods especially the ones for Paging (eg. returning a page). Using @PostFilter works on Lists (but I…
beginner_
  • 7,230
  • 18
  • 70
  • 127
11
votes
1 answer

How to let IDEA auto import pom.xml with Annotation Processors defined

I am using QueryDsl, so my source depends on generated code. FIRST Whenever IDEA (auto) imports pom.xml, the following setting is always empty: Build, Execution, Deployment -> Compiler -> Annotation Processors -> Annotation Processors I have to…
Raymond
  • 885
  • 10
  • 28
11
votes
1 answer

Replacement of import org.springframework.test.context.transaction.TransactionConfiguration; in Spring Test 4.3.1 version?

I'm working on the JPA QueryDSL example. In this example I created PersonDaoTest.java. Earlier I was using the lower version of spring-test as client asked to update it its latest version so I used 4.3.1.RELEASE. When I used this version I see that…
user4821194
11
votes
1 answer

Spring - Advanced comparator for QueryDsl support

Following the official documentation, adding @EnableSpringDataWebSupport annotation to my Spring configuration allows to automatically inject a Predicate class in query: @RequestMapping(method = RequestMethod.GET, path="/find") public…
phoenix7360
  • 2,807
  • 6
  • 30
  • 41
11
votes
4 answers

QueryDSL and SubQuery with Tuple condition

I am trying to write a query in QueryDSL to fetch the oldest elements of a table grouped by their parentId. The SQL equivalent should be: SELECT a.* FROM child a INNER JOIN ( SELECT parentId, MAX(revision) FROM child GROUP BY…
Guillaume F.
  • 5,905
  • 2
  • 31
  • 59
11
votes
2 answers

QueryDSL Window functions

How can I write a query using window functions and selecting all fields in QueryDSL? In the docs there is an example like this: query.from(employee) .list(SQLExpressions.rowNumber() .over() .partitionBy(employee.name) …
matteobarbieri
  • 318
  • 3
  • 9
11
votes
4 answers

querydsl transformer group by count

I am stuck trying to get a query (QueryDSL) to work that gives me a count of distinct categories. For example, what I am trying to achieve: categoryA -> 10 entries categoryB -> 20 entries This is what i have so far: query().from(application) …
Wouter Willems
  • 432
  • 2
  • 6
  • 19
11
votes
1 answer

QueryDsl - case expression with string value

QueryDsl 3.3.4 Hibernate 3.6.10-Final I have two entities: public class Document { private Confirmation confirmation; } public class Confirmation { ... } I need a query like this: SELECT count(d.id), CASE WHEN d.confirmation_id IS NULL…
wiecia
  • 275
  • 2
  • 3
  • 12