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

QueryDsl orderBy specific string values

I need to sort my database response by three different strings. Field can take only those four values "A", "B", "C", null. Is there a way to sort data in custom defined order while retrieving it from DB using QueryDsl? customOrder = ["B", "A",…
lickerish
  • 43
  • 6
0
votes
1 answer

Elasticsearch Query DSL: Length of field, if field exists

Say I have a field, data.url. Some our logs contain this field, some do not. I want to return only results where data.url is more than, say, 50 characters long. Really I just need a list of URLs. I'm trying: GET _search { "query": { "bool": { …
jamesdeluk
  • 186
  • 2
  • 16
0
votes
1 answer

QueryDSL - add subquery into FROM statement (2021)

In 2013 according to @Timo Westkämper (see QueryDSL - add subquery into FROM statement) it was possible to include a subquery in a FROM clause. Nowadays it seems this is not longer possible as JPQL specification does not allow…
jaime737
  • 23
  • 4
0
votes
2 answers

Is there a way in QueryDSL to use JsonProperty Names in the query string instead of field names

When the entity classes were first created they were modeled in JPA to match database field names. For our rest endpoints we used JsonProperty to let Jackson auto map names the client would expect they are kabob case. However we are now implementing…
dstigue
  • 31
  • 10
0
votes
1 answer

Querydsl fetchCount() & fetch() NullPointerException, Connection is closed

My goal is to implement dao method within pagination, sorting and filtering. For pagination I need get firstly count and then set offset & limit and get result (so get just one "page" from database): @Slf4j @Repository public class…
sasynkamil
  • 859
  • 2
  • 12
  • 23
0
votes
0 answers

Can Querydsl support INSERT from a subquery?

I have a simple schema for storing links in two different ways and I'm migrating from one to the other. Where an old-style link does not have a matching new-style link, I've been able to use Querydsl to migrate using an INSERT from a subquery.…
dave
  • 11,641
  • 5
  • 47
  • 65
0
votes
1 answer

Join a many to many relation with QueryDSL and JPASQLQuery

I have the following entities: @AllArgsConstructor @EqualsAndHashCode(of = {"name"}) @Data @NoArgsConstructor @Entity @Table(schema = "eat") public class Pizza { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE,…
doctore
  • 3,855
  • 2
  • 29
  • 45
0
votes
1 answer

Using column names in orderBy clause in querydsl

I'm wondering if there is a way to use column names in orderBy clause in querydsl JPA. I want to build multiple orderBy conditions from column names coming from the external input. Let's say I have entity Person and column names to sort. I want to…
jyshin
  • 841
  • 1
  • 8
  • 15
0
votes
1 answer

Spring Data Web Support for QueryDsl works sporadically upon application startup; customizer not always invoked

My project uses Spring Boot 2.1.3, Java 8, QueryDsl 4.2.1. (It is a mature critical project, and upgrading the SB version to the latest 2.4.4 is not feasible at the moment.) Recently, I have added Spring Data web support to simplify binding request…
cvnew
  • 570
  • 1
  • 7
  • 13
0
votes
1 answer

Problem with sum() in QDSL CaseBuilder in Java

I get error when running unit test using a code where this part with CaseBuilder() is used in the list(). new CaseBuilder() .when((((vTVw.value.abs().goe(20))) .or(null))) .then(1) .otherwise(0) .sum() Here is the part from…
eRic
  • 15
  • 8
0
votes
1 answer

@QuerydslPredicate with @EmbeddedId

I have an endpoint in which im using @QueryDslPredicate to bind HTTP parameters, but the root or class that im using to bind the parameters has an Embedded id and im trying to search with one of the id-s that are in the compound id that i created.…
0
votes
1 answer

Elastic Search: Combining multiple queries into one

In my application, we have a search bar where a user can enter either first name, last name, ID, or an Email address. I am querying on User's data which is having the following fields, First Name, Last Name, ID, Email For querying the first name,…
Frosted Cupcake
  • 1,909
  • 2
  • 20
  • 42
0
votes
2 answers

Spring Boot QueryDsl java.lang.UnsupportedOperationException

//Page result = (Page) repo.findAll(); Page result = repo.findAll(builder, pageable); System.out.println("넘어오긴했음"); System.out.println("PAGE SIZE : "+result.getSize()); System.out.println("TOTAL PAGES : " +…
0
votes
1 answer

QueryDSL fetchJoin does not fetch the data

I am facing this issue: Lets assume I have 3 entities like this: Entity A: long id String someField // No bidirectional linkage to B entity via hibernate Entity B: long id String someBField @ManyToOne(optional = false, fetch =…
Johnczek
  • 532
  • 9
  • 30
0
votes
1 answer

IF funtion in QueryDsl

How to write this query in queryDsl select * from Table order by if(a = 0, b, a) desc I struggle with the if(a = 0, b, a) part SOLUTION orderBy(Expressions.stringTemplate("if({0} = 0, {1}, {2})", a, b, a).desc())
1 2 3
99
100