Questions tagged [criteriaquery]
245 questions
0
votes
2 answers
Query list of IDs for value not in table
I have a List of IDs, that I'd like to filter for values that are not present in the database table.
Something like this:
SELECT ids
FROM (VALUES('id1'),
('id2'),
('id3'),
('id4')) I(ids)
EXCEPT
SELECT…

JankoHrasko
- 93
- 1
- 8
0
votes
1 answer
Spring boot JPA Specification API with Pagination and Sorting
Im trying to implement a search in spring boot. Since the search params is dynamic, i had to go for specification api. My requirement is to search for orders given certain params and sort those orders by creation date. Since data can be large, the…

Mohammed Rafeeq
- 1
- 5
0
votes
1 answer
Spring Boot QueryDSL BooleanExpression - "OR" condition depending on the value in table
I use Spring Boot and QueryDSL to combine a sql query and predicate. The problem is that I have to create a predicate to fetch data from table based on email BUT:
email can be in Freight.sender.email
OR in Freight.message.senderAddress
where…

Matley
- 1,953
- 4
- 35
- 73
0
votes
1 answer
Using Java Predicates in MYSQL AND condition
I have the following java predicate based code that gets a result list from my MYSQL DB:
Root from = query.from(Person.class);
CriteriaQuery selectQuery = query.select(from);
List searchResults = new ArrayList<>();
Predicate…

java12399900
- 1,485
- 7
- 26
- 56
0
votes
1 answer
JPA Criteria API and Oracle JSON_TABLE function
I have a problem with writing criteria in java based on sql code, we must use JSON_TABLE function and search by parameters:
select tab1.id
from TABLE1 tab1
left join
TABLE2 param_json on tab1.id =…

prusiu
- 31
- 6
0
votes
1 answer
Hibernate returns an object not null, but that is strangely lazy itself : JavassistLazyInitializer
The problem is not always reproducible, it's when getting my object from the database using CriteriaBuilder.
Code :
@Entity
@Table(name = MyEntityObject.TABLE_NAME)
@Access(AccessType.FIELD)
@Cache(usage =…

Belham
- 155
- 1
- 1
- 12
0
votes
2 answers
How to use ScrollableResults for Hibernate Queries when joining many different entities
I am using Spring Boot endpoints to return results from database queries. It works fine when using getResultList() on the TypedQuery. However I know I will have to managed very large data sets. I am looking into using ScrollableResults via hibernate…

Ryan
- 61
- 6
0
votes
1 answer
The use of java sprintboot JAP criteriabuilder (and or)
I have a question about CriteriaBuilder API. I am new in JPA, I would like to creates (and or)combination。
predicates.add(cb.equal(root.get("title"),title));
predicates.add(
cb.or(cb.between(root.get("startedAt"),startTime,endTime),
…

a a aa
- 1
0
votes
0 answers
Search Script with 2 criteria. Google API and Spreadsheet
I have a form with 5 fields connected to a Google Spreadsheet. When my user input data in the first 2 fields the 3 other fields update according to the data of the Spreadsheet.
My script is working perfectly with one criteria but I need second…

Jean
- 83
- 3
- 10
0
votes
1 answer
JPA search query using Criteria Builder for multiple columns
I am trying to make a universal search for my entity with criteria builder where a given text is matched with all the columns in the entity.
String likeSearchText = "%" + searchText + "%";
List searchedCustomers = null;
CriteriaBuilder…

Kay
- 142
- 2
- 10
0
votes
2 answers
Convert PosgreSQL to Criteria API
In my spring app, I have two tables. Among workers, there are bosses and both roles can make items.
I want to know how many items were made by definite bosses workers (include bosses items) and made after 11.9.10 (as an example, it should be…

Семен Немытов
- 299
- 2
- 15
0
votes
1 answer
How to get an intersect query using CriteriaQuery?
Given :
@Entity
public class entity_details {
@Id
private int id;
@column(name ="entity_id")
private int entityId;
@column(name="att_id")
private int attId;
@column(name="att_value")
private string attVal;
I want to find a equivalent query to…

Lakhan Gupta
- 1
- 1
0
votes
2 answers
How to fetch data based on date using criteria query?
I'm working with criteria query and want to fetch data based on date. However, criteria query like condition does not work with date.
i get date like 2020-08-25 from user.
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery cq =…

chiranjiv
- 81
- 7
0
votes
0 answers
Spring Boot - JPA Repository @Query for mismatching entity field types
How can I compare two entity fields with different data types in a @Query-statement?
I read about critera queries and know that there are functions that can modify parameters before they are used in the sql-statement, e.g. upper() or lower() like…

Greta
- 300
- 1
- 10
0
votes
2 answers
JPA Criteria: Obtain total count just before full result with all columns; reuse Where clause
In JPA Criteria I have a complex query which works. It involves many Joins and a complex Where clause. But right before I run it for the full selection, I need to get a quick COUNT of the full resultset.
I tried to reuse my where clause and all my…

gene b.
- 10,512
- 21
- 115
- 227