Questions tagged [criteriaquery]

245 questions
1
vote
1 answer

Construct a Criteria Api Predicate that overlaps a tsrange column type in Postgresql

I want to create a Java Criteria Api Predicate that performs the equivalent SQL query in Postgres 15 as follows: SELECT time_range_column FROM public.address_table WHERE time_range_column && '[2014-09-23, 2015-09-24]'::tsrange; I declared the…
1
vote
0 answers

How to fetch using specific date from timestamp column in Criteriaquery?

I have a timestamp column in database and want to query date like this 2023-07-27, Here is my snippet: List predicates = new ArrayList<>(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); …
amanuel zerfu
  • 33
  • 1
  • 7
1
vote
1 answer

Distinct results from Spring Data JPA Specification by one column

I have the following table on database: id employee_id title created_at 1 10 title1 2022-10-10 1 10 title2 2022-10-11 I want fetch data by distinct on title column; by sql I can do this: select distinct on (employee_id) * from…
mgh
  • 921
  • 3
  • 9
  • 37
1
vote
1 answer

Spring data jpa specifications and projections error

I am getting below error when I use (https://github.com/pramoth/specification-with-projection) Caused By: org.springframework.data.mapping.PropertyReferenceException: No property findOne found for type any idea why its throwing this…
1
vote
1 answer

How to eagerly fetch a child list from a child object using CriteriaQuery?

I have two models: Model Funcionarios @Entity @Table(name = "funcionarios") public class Funcionario extends Model { .... @NotFound(action = NotFoundAction.IGNORE) @ManyToOne(fetch = FetchType.LAZY, optional = true) private…
KenobiBastila
  • 539
  • 4
  • 16
  • 52
1
vote
0 answers

Postgresql Using Predicate - query text array field contains any of the value in input list

I am using postgresql database ans using criteria method to query to my springboot app I have a table containing a field called status which is a text array field which can have values any or multiple of these…
Abhi
  • 101
  • 6
1
vote
0 answers

JPA Criteria for MAX id GROUP BY SIGNLOGUUID field (solved)

I am practicing with my first java project... Developing an application using Spring Boot and Spring Data JPA. The following are entities: @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "Id", nullable = false,…
Jessie
  • 11
  • 3
1
vote
1 answer

Criteria Builder Multiple Joins

I have 4 different tables on which Joins are applied and this is working fine with SQL Query SELECT donor.title, SUM(donation.donated_amount) + SUM(donation.gift_aid), SUM(donation.donated_amount) FROM checkout checkout JOIN donation donation ON…
1
vote
0 answers

JPA Spring -How to use criteria query on Object[] using spring jpa -Getting is not a Object[] or List

How do i write criteria api for the below entity of type string-array @Table(name = "Test") public class Test { @Type(type = "string-array") @Column(name = "tempCol",columnDefinition = "text[]") public List
s_91
  • 11
  • 2
1
vote
0 answers

Getting a count of results from an arbitrary JPA CriteriaQuery

I have an issue where the code at the layer I am working in receives a CriteriaQuery object. I have virtually no other information about the query (though I can make a good guess as to the type of object or object list it should return.) What I…
cWarren
  • 453
  • 5
  • 11
1
vote
0 answers

Best way to convert a Java string to Solr criteria query

I am not well versed in java and Solr, so apologies if this is a basic question. I have a string that I need to convert to a Solr criteria. String rule = "(index_key_parentcategory = \"Workwear\" AND index_key_category = \"Women\" AND…
1
vote
1 answer

I want to update values ​in an array in an array while using MongoTemplate

First, I will show the state stored in mongodb. As you can see, it is a structure with a list called replies in a list called comments. And inside replies there is an array called likes. comments : [ Object1 : { replies : [ …
hanjiman
  • 465
  • 1
  • 6
  • 17
1
vote
1 answer

Order by a list in JPA criteria query

My use case is to order the response from a table as per the order of values in a list. The MySQL query for that which is working as expected is: SELECT property_uuid, micromarket_uuid, city_uuid, SUM(obligation_booked) FROM …
1
vote
1 answer

How to write Criteria Query that checks for multiple values in same column along with other WHERE conditions?

Please convert the following SQL Query to a Criteria Query--------- I have the following table PEOPLE- ID Name Code 1 Tom A 2 Harry B 3 Tom C 4 John A 5 Sally C 6 Tom B 7 Tom D The query must return the list of records that…
1
vote
0 answers

How to write subquery for inner join using criteriabuilder and read the count in the multiselect

Below is the corresponding Mysql query and its a working query : select tab4.id, tab4.name, tab7.city, tab7.state, tab7.phone, tab5.status_priority, tab5.model,tab5.code, tab5.number, tab5.ds_formatted_timestamp group_concat( distinct…
Karma J
  • 59
  • 4