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.
1,868
questions
0
votes
1
answer
13
views
I am trying to convert SQL to Query DSL i want join 2 tables User table and News table to find who is post most blog
Here is the original sql
enter image description here
I tried to conver to query dsl but it just not working
enter image description here
0
votes
0
answers
26
views
How to perform sum aggregation on n number of documents after sorting records (descending) ? elastic
{so, i want latest 30 document between 20/6 to 20/4 and perform the sum aggregation on field duration_seconds of those 30 latest doc. we had tried multiple aggregation on that like top_hits, terms for ...
0
votes
0
answers
20
views
PPL like CASE WHEN in SQL
I was trying to figure out whether I can create a piped processing language (PPL) query like we did in SQL. Is there any idea how I can create PPL for the below sql query?
select colA,
count(case ...
0
votes
0
answers
20
views
How to search specified objects from a jsonb column using querydsl in java
In my postgresql, I have a table in which there is a column of type jsonb. This is my java class of that table:
@Table(schema = "public", name = "vw_user_site_role_permission")
@...
0
votes
0
answers
14
views
conditional join on Querydsl
I want to make a join each table would be join when matched with condition.
for example,
jpaQueryFactory.select(test).from(test)
if (ConditionA != null) {
.innerjoin(a).on(..)
}
could you give me ...
0
votes
0
answers
10
views
In QueryDsl, brackets inside whereclause give different desired result
Execute a query with QueryDsl in Spring boot(Kotlin).
I want a result like this:
SELECT *
FROM A
LEFT JOIN B ON A.b_id = B.id
WHERE (a.createdAt >= ? AND a.createdAt <= ?)
OR (b.createdAt ...
0
votes
0
answers
10
views
Opensearch DSL - Find records with field not equals each other
Is it possible to query records that has two field not equals each others?
For example:
SELECT * FROM <index> WHERE FIELD1!=FIELD2;
0
votes
0
answers
24
views
Querydsl - cross apply json
I want to use cross apply from sql-server in my querydsl-sql query with a json field but cant get it right.
I have two tables: old_table and updated_table which I want to merge.
The data to merge:
...
0
votes
1
answer
40
views
elasticsearch-6.8.13, Multi Match Range Query is not working
I am using the ElasticSearch custom DSLs & want to use the query to find the accommodations that have adults gte [:adults] & lte [:perfect_adults]. Its not working even if we used the static ...
0
votes
0
answers
37
views
QueryBuilder.wrapperQuery is giving wrong output
I am trying to fetch the data from the elastic search using Querybuilder.wrapperQuery using restHighLevelClient. But it gives me empty data whereas the same query runs using postman with extra query ...
0
votes
1
answer
27
views
How to combine Boolean AND with Boolean OR in Elasticsearch query?
Query: Get employee name "Mahesh" whose id is "200" and joining datetime is in a given date range and his epf status must be either 'NOK' or 'WRN'. (Possible values of epf_status ...
0
votes
0
answers
37
views
elasticsearch query search by keyword and sort results by price
this is my current search query
"query":{
"bool":{
"filter":[
{
"term":{
"status":{
...
0
votes
1
answer
22
views
elasticsearch query dsl show products with higher product quantity at the top
i want to search products based on some filters and a keyword which in my code identified by q. what i trying to do is to show products which product_quantity is not equal to zero at the top.
this is ...
0
votes
0
answers
14
views
Doc_count per value in Elastic
I wondering if there is way to perform count total on the "doc_count" output in query.
I performed the next query below:
{
GET index/_search
{"query": {"bool": {"...
0
votes
0
answers
10
views
parsing_exception [sort] query malformed, no start_object after query name Opensearch
I'm trying to sort by field but gives this error.
Error:
0
votes
0
answers
20
views
how to convert mysql query to querydsl
SELECT start_date
FROM test
where start_date between DATE_FORMAT(NOW() ,'%Y-%m-01') AND DATE_SUB(NOW() , INTERVAL 1 day);
SELECT start_date
FROM test
where start_date BETWEEN CURDATE() and ...
0
votes
1
answer
41
views
Spring Data JDBC + Querydsl: error "JdbcRepositoryFactory does not support Querydsl"
I want to use Spring Data JDBC with QueryDSL support. According to Spring documentation (https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#core.extensions.querydsl) it is supported, ...
0
votes
0
answers
20
views
Query dsl - Looping through a list to create OR predicates
How do I dynamically create "OR" predicates if I have a List<List<String>>
I am using query dsl and spring data.
QOrder order = QOrder.order;
JPQLQuery<Order> query = from(...
0
votes
0
answers
14
views
How to alter sequence using Querydsl?
Is it possible to write the following query using Querydsl?
ALTER SEQUENCE users_id_seq RESTART
0
votes
2
answers
26
views
Unable to properly compare table columns with different types
I'm trying to use querydsl to build a query which joins two tables. However, a slight discrepancy between the corresponding Java class data types seems to prevent me from directly comparing the two ...
-1
votes
2
answers
21
views
How to map multiple data rows to different fields
I'm trying to use querydsl and projection to map the results of a query onto an object.
I have something like the following:
public record DataTransferObject(MyTable obj1, MyTable obj2) {
public ...
0
votes
0
answers
23
views
querydsl group by and sum of a column for each group
I have a query that i use to filter and get sum of a column for each group in the dev tool.
GET readers/_search
{
"size": 0,
"aggs": {
"usr_agg&...
0
votes
0
answers
27
views
group by kibana Query Opensearch
I have fields ID, Type, Count and timestamp as follows:
{ "ID": "15211", "Type": "C", "count": "17", "timestamp": "Jun 3, ...
0
votes
0
answers
31
views
QueryDSL: How to join fetch nested entities
I've been struggling to join nested entities using QueryDSL.
My entities are mapped like like:
Job > ManyToOne Location > OneToOne Address
They are set to lazy-load using Hibernate byte code ...
-1
votes
0
answers
25
views
get most recent distinct rows from AWS OpenSearch(Elasticsearch)
I created index pattern and it has 4 fields(timestamp,Id,Type,Count). Need to get the most recent(based on thetimestamp)rows with unique Type.
Sample data:
Expected output:
After the ordering ...
0
votes
0
answers
10
views
get latest distinct rows from AWS opensearch discover
I have to create a saved object(to build a visual) in AWS OpenSearch discover(not in dev tool using search) tab that contains the latest distinct rows.
data fields are :
Let's say there are 5 food ...
0
votes
0
answers
44
views
QueryDSL order by subquery count
I want to implement the following SQL query with QueryDSL:
SELECT
*
FROM
a
ORDER BY (
SELECT
COUNT(*)
FROM
b
WHERE
b.a_id = a.id
AND b.c = 1) DESC
...
0
votes
0
answers
57
views
Failed to execute goal com.querydsl:querydsl-maven-plugin:5.0.0:export (default) on project my-project: Stream has already been closed
After upgrading Spring-boot to v2.6.7, I upgraded querydsl from 4.2.1 to 5.0.0. After that querydsl-maven-plugin stated to fail with the error message "Failed to execute goal com.querydsl:...
0
votes
0
answers
37
views
How to compare two fields with different date types in querydsl + mongodb
I had many attempts but I can't resolve my problem.
I have 2 date types in mongodb collection.
@Document(collection = "someCollection")
public SomeCollection {
LocalDateTime firstDate
...
0
votes
0
answers
35
views
Spring Boot No qualifying bean of type 'org.springframework.data.jpa.repository.support.CrudMethodMetadata'
I'm trying to create custom QueryDSL executor that would take whole query as input. I wan't to get queryHints and LockMode from metadata, but I can't access DefaultCrudMethodMetadata from org....
0
votes
1
answer
57
views
Set up Spring Boot Data and Querydsl: Not generating metamodels (using Intellij IDEA)
I'm trying to set up a project using Querydsl. I have tried to follow the official docs v5.0.0 and v4.4.0 but the metamodels do not get generated (except once, then I changed something, rebuilt, they ...
0
votes
1
answer
25
views
How can extract params from querydsl Spring Boot?
As we know that Querydsl get Peageable and Predicate as parameters but how can I extract the params from this querydsl? because I must get the Id that I passed in postman so that I can use it.
That's ...
0
votes
1
answer
26
views
Querydsl Contains Column value in a String
Generally we can use QObject.column.in(String[]) to find rows that specific column value in a string list. But how can we filter if column value exists in a large string?
Something like QObject....
0
votes
1
answer
50
views
No class def found error when building maven project
I am using querydsl and when I am trying to build maven project it fails:
Caused by: java.lang.ClassNotFoundException: com.mysema.codegen.model.Type
<dependency>
<groupId>com....
1
vote
0
answers
75
views
Querydsl configuration for Gradle 7.4.2
I have a Gradle project into which I want to implement Java class with querydsl. I tried this implementation:
plugins {
id 'org.springframework.boot' version '2.6.7'
id 'io.spring.dependency-...
0
votes
1
answer
51
views
ClassNotFoundException: com.google.common.collect.Multimap JPAQuery
So I want to use JPAQuery to make filtration in my spring app but this line:
@PersistenceContext
EntityManager em;
JPAQuery <Customer> jpaQuery = new JPAQuery<>(em);
is throwing:
java....
0
votes
1
answer
44
views
Spring boot mongodb querydsl - java.lang.NoClassDefFoundError: com/querydsl/apt/AbstractQuerydslProcessor
I'm trying to use Querydsl in my spring boot project but when I try to generate Qclasses it is giving an error
Caused by: java.lang.ClassNotFoundException:
com.querydsl.apt.AbstractQuerydslProcessor
...
0
votes
0
answers
22
views
Add multiple lists in one projection of QueryDSL
I would like to create a projection (in QueryDSL) with multiple lists in.
public class Dto {
long id;
List<ADto> as;
List<BDto> bs;
public static FactoryExpression<Dto&...
0
votes
0
answers
96
views
Filter for max date in Opensearch Query DSL
I created a data table in Opensearch dashboards. I have 2 text fields (ID & Date) and the index pattern was created in AWS ElasticSearch. I would like to display the records where DATE = max(DATE) ...
0
votes
0
answers
29
views
When I open a querydsl JPA project with vscode,Vscode has many connot be resolved errors
When I open a querydsl JPA project with vscode,Vscode has many connot be resolved errors
The import com.**.QRoutePayload cannot be resolved
and I open with IDEA,It's all right
0
votes
0
answers
11
views
How can I use querydsl to know posts by user?
I have four Tables
Member
Post
Emotion_post
Emotions
Now I want to make review logic
And at select logic, I dont' know how to represent members post such as...
First post by member1.
First post by ...
0
votes
1
answer
13
views
Spring QuerydslPredicate - exception handling for bad types
I didn't find any proper solution for this so maybe you can assist. Basically issue is ultra simple I want to do some kind of "better looking" error handling when using QuerydslPredicate
I ...
0
votes
0
answers
52
views
querydsl cannot find symbol error in spring boot mongo
I'm trying to use @querydslpredicate and tried to add all the
dependences and plugin for the same
<dependency>
<groupId>com.querydsl</groupId>
<...
0
votes
0
answers
44
views
Spring Data Mongodb with QueryDsl
plugins {
id 'org.springframework.boot' version '2.6.6'
id "com.ewerk.gradle.plugins.querydsl" version '1.0.10' }
configurations {
compileOnly {
extendsFrom ...
0
votes
1
answer
86
views
Elastic search DSL query to match the log message with starting and ending text
The log messages are like below
The application node ABC is down
The application node BCD is down
The application node XXX is down
I have written the following query but it is not working
"...
0
votes
0
answers
37
views
Querydsl convert to varchar - SQL server
In SQL server to get value from field ,I need to use convert(varchar,column)
Data type is percentage float.
Value is like -0.07
Issue in QueryDsl
. I am not able to find similar way to convert data to ...
0
votes
0
answers
26
views
how to insert subQuery at join by "QueryDLS"
I'm using QueryDLS.
But I got some problems.
My Database server is MariaDB.
select s.* , a.user_id
from schedule s
left outer join(
select sch_idx, group_concat(user_id SEPARATOR ',') as user_id ...
1
vote
0
answers
52
views
How should I query ManyToMany property by contains(Expression<T>) using QueryDSL with jpa Entity
Observed vs. expected behavior
@Entity
@Data
class TSite {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Integer id;
String name;
@ManyToMany
Set<TKeyword> keywords;...
0
votes
0
answers
52
views
How to programmatically build a querydsl predicate searching for a key-value in a map in a set from the top of a hierarchy
I am trying to programmatically build a com.querydsl.core.types.Predicate in order to search a near-garden-variety Spring JPA repository implementing org.springframework.data.querydsl....
0
votes
1
answer
42
views
Predicate on a field of an entity class which is type of a parent class and filter on fields of its children
In the entity class A there is a field of type P1 named as p. Class P2 and P3 is extended from P1. In the predicate I want to filter the result based on a field of class P2. How can I do this?
public ...