Questions tagged [criteriaquery]
The criteriaquery tag has no usage guidance.
criteriaquery
249
questions
0
votes
0
answers
28
views
How to write join by Lateral "," in Java Criteria API JPA, Hibernate
I want to achieve the below result with ','
FROM table1 t1,
LATERAL jsonb_array_elements(secret_data->'rating'->'subRating') AS subRatings
WHERE
I want to achieve this with the Criteria API. ...
0
votes
1
answer
32
views
Blaze Persistence Criteria Query: Order by Identifier Issue with Paginated Results
I'm working on a Spring Boot application using Blaze Persistence to construct a complex criteria query for fetching paginated results. However, I'm encountering an error that states: "The order ...
0
votes
0
answers
13
views
Concatenating foreign tables in JPA Java
I have two Entity where one entity is referencing a foreign key from the other. I want to concat the name field from one entity and the name field of the other entity into a new dummy field.
Like so
@...
0
votes
0
answers
21
views
Criteria Builder Sort a Table before Joining?
I want to join multiple tables, but I wanted the first record of the last id. So I want to join Table A and Table B, sort that by Table B's Id in DESC order then join it to Table C.
CriteriaBuilder cb ...
0
votes
0
answers
36
views
How to get if there are values to update in CriteriaUpdate in Spring boot?
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaUpdate<TestClass> update = criteriaBuilder.createCriteriaUpdate(TestClass.class);
Root<TestClass> testClass =...
0
votes
0
answers
99
views
How to Implement 'or' Condition in Criteria Query with Spring Data Elasticsearch
I am developing a query builder in Spring Boot using Spring Data Elasticsearch and facing an issue with implementing the or condition in a method designed to filter actions based on multiple possible '...
2
votes
1
answer
49
views
CriteriaQuery with max
I have a table like this :
bookName updateId
----------------------------
LordOfTheRings 12
WheelOfTime 3
Cradle 9
WheelOfTime 14
Cradle 10
...
0
votes
1
answer
72
views
Hibernate CriteriaBuilder generates wrong sql output while using subquery as a selection
We have two related entity - Customer and User. There is OneToMany-ManyToOne relation between this entities as I added below. I'm trying to get many side(User) count while getting Customer pageable ...
0
votes
1
answer
55
views
How to select M:N group by JPA Criteria api
I have this two classes with relationship M:N :
package org.heller.jpa.entity;
import java.util.List;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence....
0
votes
0
answers
63
views
CriteriaQuery Joining entities in Hibernate single table inheritance
I am facing an issue while trying to perform a join involving entities in a Hibernate Single Table Inheritance scenario. I have two entities: VehicleEntity (base class) and CarriageEntity (subclass ...
1
vote
2
answers
68
views
Is it posible to use only one call to database when pagination in Java?
If the pagesize is 10 and pageNumber is 0, for the given condition, if I I get 50 documents from mongodb, then total_documents should be 50 and msList should have the details of 1st 10 documents(DTO's)...
0
votes
0
answers
63
views
Multiple Joins using Criteria builder
Trying to build the critaria for the below query
Select a.x,c.y from A a
JOIN B b on a.a = b.a
JOIN C c on b.c = c.c
JOIN D d on c.d = d.d
Tried with below Criteria
Root<A> root = criteriaQuery....
0
votes
1
answer
73
views
Sort a list of objects based on the String pattern of object attribute
I have a list of Device objects.
With attributes:
userId,
activationDatetime,
and others.
User ID is constructed as:
aaaaXXXX -> aaaa-> string, xxxx->number
aaaa String part can start with ...
0
votes
0
answers
131
views
Filter an entity by a list of tags using JPA specification API
I have a Guest entity which have a set of Tag entities in a OneToMany relationship. My goal is to filter out Guests who have an exact set of Tags.
E.g.
Tag vip = new Tag(1, "VIP");
Tag ...
0
votes
0
answers
18
views
postgres criteriaQuery with orderBy in sum
I'm trying to build this postgres query snippet with criteriaQuery:
select
sum (attr order by attr2)
The problem is that because of floating point precision the order of the attr2 values is ...