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
10
votes
2 answers

How to count distinct items on specific fields in QueryDSL

Edit: it turns out that JPA can't express this. The solution was to rewrite in SQL. I'm using QueryDSL to perform an aggregate query on a JPA data set for reporting. I have no problem extracting the report data. For example: ... query =…
Adrian Cox
  • 6,204
  • 5
  • 41
  • 68
10
votes
3 answers

Convert Sql like custom dsl queries to ElasticSearch?

We are building our own query language similar to Mysql using antlr4. Except we only use where clause, in other words user does not enter select/from statements. I was able to create grammar for it and generate lexers/parsers/listeners in…
omurbek
  • 742
  • 1
  • 7
  • 23
10
votes
2 answers

"MultipleBagFetchException: cannot simultaneously fetch multiple bags" when joining three depth table

org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags: [Order.items, OrderItem.options]; Above is an exception i faced when i join three tables…
crazy_rudy
  • 533
  • 2
  • 4
  • 19
10
votes
2 answers

Write queryDSL predicate query for oneTomany relation based query

I am using spring-data, QueryDSL and MySQL. Main aim of question is to know how to do a such a query in queryDSL way. Given example is just a simple example to give idea. Say for example, there are two tables Employee and Certificate. Relation…
Prashant Shilimkar
  • 8,402
  • 13
  • 54
  • 89
10
votes
2 answers

IntelliJ 15 with QueryDSL and Gradle

I have a Spring-boot 1.4 project in IntelliJ 15 using gradle 2.3 and QueryDSL 4.1.3 that won't build because my entities are not being built into Q classes by Querydsl. I have the following: buildscript { ext { springBootVersion =…
sonoerin
  • 5,015
  • 23
  • 75
  • 132
10
votes
3 answers

Performance tests between QueryDSL SQL vs JDBCTemplate

I am trying to convince "the higher ups" to use querydsl sql for our persistence. But they prefer spring jdbctemplate, with the reason being it gives the best raw performance. Performance is our primary requirement ofcourse. Which is why JPA isnt an…
ameenhere
  • 2,203
  • 21
  • 36
10
votes
4 answers

QueryDsl SpringData Jpa findAll how to avoid count()

I'm trying to use QueryDSL with Spring Data JPA, I want to use findAll with pagination but the count is always performed, also if return type is a List. I don't need this count because it is really slow and I could loose the benefit of…
Etantonio
  • 359
  • 1
  • 5
  • 13
10
votes
4 answers

SQL DSL for Scala

I am struggling to create a SQL DSL for Scala. The DSL is an extension to Querydsl, which is a popular Query abstraction layer for Java. I am struggling now with really simple expressions like the following user.firstName == "Bob" || user.firstName…
Timo Westkämper
  • 21,824
  • 5
  • 78
  • 111
10
votes
1 answer

Mysema Querydsl: There's no JPAQuery#list() method

Some online examples for Mysema Querydsl usage rely on the JPAQuery#list() method, e.g. this stackoverflow answer containing a GROUP BY / COUNT aggregate example. It is also referred to throughout the official documentation. However, I do just not…
SputNick
  • 1,231
  • 5
  • 15
  • 26
10
votes
1 answer

Custom data types using EclipseLink and Querydsl

I've created a custom data type for storing valid and normalized email addresses: public class Email implements Serializable { private final String value; public Email(String emailAddress) { this.value = normalize(emailAddress); …
sinuhepop
  • 20,010
  • 17
  • 72
  • 107
9
votes
3 answers

Java using filtering at different models before and after the projection

Consider the following JAVA model for hibernate: @Entity @Table public class Person { @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long id; @Column public String firstName; @Column public String…
jvitor83
  • 220
  • 8
  • 20
9
votes
1 answer

QueryDSL @OneToOne Join-FetchMode with Hibernate

Suppose we have a simple entity "Customer" which has a OneToOne relationship to an entity "Address". The foreign key is on the address side. @Entity public class Customer extends EntityBase { @Column(name = "name", nullable = true) private…
MatWein
  • 167
  • 1
  • 13
9
votes
2 answers

spring mongo querydsl Can't find a codec for class java.time.LocalDateTime

I use spring mongo data rest and querydsl the domain: has a property: @DateTimeFormat(iso = ISO.DATE_TIME) private LocalDateTime registerTime; To use Json ,I add : jackson-datatype-jsr310 the LocalDateTime can work…
Kery Hu
  • 5,626
  • 11
  • 34
  • 51
9
votes
2 answers

Querydsl - paging functionality

It seems that in Jpa QueryDsl I can use paging like: return new JPAQueryFactory(getEntityManager()) .selectFrom(entity) .where(where_clause) .orderBy(order_by_clause) .offset(pageNumber * 20) .limit(20) …
Ziemowit Stolarczyk
  • 1,014
  • 2
  • 11
  • 26
9
votes
2 answers

The type com.querydsl.core.types.Predicate cannot be resolved. It is indirectly referenced from required .class files

I have a Maven Spring-Hibernate-JPA-QueryDsl web application in Eclipse that is giving the error The type com.querydsl.core.types.Predicate cannot be resolved in a CommonRepositoryImpl.java class. The error marker appears at the package declaration…
John M. Yount
  • 101
  • 1
  • 1
  • 8