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
18
votes
1 answer

Querydsl set fetch mode in a query

I have a situation where a Card entity has a foreign key to a Person. public class Card implements java.io.Serializable { private String cardid; private Person person; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "USERID") …
Marko
  • 345
  • 1
  • 3
  • 11
17
votes
1 answer

Is there a generic REST query language for JPA, spring-data, spring-data-rest

Requirements generic query language that can be used in GET requests to collection resources in REST api to filter the set of resources returned queries passed in via a "standard" query language and sent over HTTP as request parameter(s) - .e.g …
Nathan Coast
  • 171
  • 1
  • 8
17
votes
1 answer

Spring data Mongodb: QueryDsl Predicate and Criteria API interoperability

I'm using QueryDSL predicates with Spring Data Mongodb. However, I'm facing situations where I have to use the Query API with MongoTemplate (for instance to filter fields to fetch from Mongo). Here is a simple example: public Stream
Benoit Guillon
  • 171
  • 1
  • 4
17
votes
1 answer

Using querydsl how can I check against a specific object from a set of objects that result from a One to Many relationship?

I have a Person JPA entity, and my Person has multiple addresses (OneToMany relationship from Person to Address). I want to be able to do a query for all people that have a particle zipcode but I'm not sure after looking at the querydsl…
codeLes
  • 3,021
  • 3
  • 29
  • 27
16
votes
2 answers

Criteria Api Vs QueryDsl Vs JPA metamodel

I am a bit confused about these three concepts. Criteria API Query Dsl Jpa 2.0 meta model From what I have read, One of the major benifits of using QueryDsl or JPA metamodel is type safety. But I can achieve type safety even with Criteria API's.…
pvpkiran
  • 25,582
  • 8
  • 87
  • 134
16
votes
3 answers

QueryDsl classes are not generated in IntelliJ

I have the following class and I would like to try out querydsl and make some basic queries. Using intelliJ 2017.3, no class QUser is generated. I've tried googling my problem and each SO answer seems to offer a different solution (some didn't work…
Xzenon
  • 1,193
  • 2
  • 15
  • 37
16
votes
2 answers

Exception using Spring Data JPA and QueryDsl via REST Controller

I'm trying to implement a controller method similar to how is documented in the latest Gosling release train of Spring Data that supports QueryDsl. I've implemented the controller as shown in the example in the docs at…
16
votes
1 answer

QueryDSL / JPQL : how to build a join query?

I've tried to read through the QueryDSL docs but I am still very confused. I'm accustomed to writing a lot of SQL, but this is my first real crack at using QueryDSL w/ JPQL (JPA2). I have the following entity: @Entity public class Provider…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
16
votes
2 answers

How to call mysql function using querydsl?

I am in little hurry so, i just want to ask a quick question about querydsl. According to my research, query dsl doesn't support stored procedure but can support database functions. My Question is how can we invoke those database functions using…
Mani Rai
  • 665
  • 2
  • 9
  • 22
16
votes
2 answers

How to get fully materialized query from querydsl

I am trying to use querydsl for building dynamic queries for dynamic schemas. I am trying to get just the query instead of having to actually execute it. So far I have faced two issues: - The schema.table notation is absent. Instead I only get the…
MickJ
  • 2,127
  • 3
  • 20
  • 34
15
votes
2 answers

QueryDsl web query on the key of a Map field

Overview Given Spring Data JPA, Spring Data Rest, QueryDsl a Meetup entity with a Map properties field persisted in a MEETUP_PROPERTY table as an @ElementCollection a MeetupRepository that extends…
Eric J Turley
  • 350
  • 1
  • 5
  • 20
15
votes
2 answers

Best practise when using Querydsl with Spring Data

Using Spring Data nad Querydsl we can just declare repository interface and skip the implementation class. Some methods with a specific name or using @Query annotation and that's all. But sometimes I'd like to use JPAQuery and define method's body…
pzeszko
  • 1,989
  • 18
  • 29
15
votes
1 answer

Querydsl join on same table multiple times

Let's say I have two tables Task and Company. Company has columns id and name. Task has two columns customerId and providerId which link back to the id column for Company. Using Querydsl how do I join on the Company table twice so I can get the name…
Josh
  • 2,842
  • 8
  • 45
  • 51
15
votes
2 answers

Spring-Data-JPA with QueryDslPredicateExecutor and Joining into a collection

Let's say I have a data model like this (pseudocode): @Entity Person { @OneToMany List attributes; } @Entity PersonAttribute { @ManyToOne AttributeName attributeName; String…
digitaljoel
  • 26,265
  • 15
  • 89
  • 115
15
votes
1 answer

Spring Data Specification or QueryDSL

In one of the projects, we are using Spring Data. Now that the queries are getting complex, we thought about adding Spring Data Specification or QueryDSL. However, not sure about the best way forward. I think they both serve the same purpose. Is…
adi
  • 1,711
  • 3
  • 29
  • 50