Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
21 views

Impossible to use DATEDIFF in java JPA criteria queries?

For the life of me, I cannot figure this out. I want to select entities from my H2 database, and get the difference between an entities timestamp column and a passed parameter. trying var dateDiff = ...
diet coke's user avatar
1 vote
0 answers
37 views

JPA CriteriaQuery: using same expression in select and orderBy

I tried to write belowed SQL with CriteriaAPI in Hibernate 6.2.6: select foo.id, foo.bar, bar.name from foo left join bar on bar.code = foo.bar order by bar.name; This is my kotlin code:...
dtadescu's user avatar
1 vote
0 answers
18 views

CriteriaBuilder count(*) instead of count(id)

I'm creating a dynamic query in a Spring Boot (3.3) app, with Hibernate, Postgresql behind... This is a simplified pseudocode version: CriteriaQuery<Long> counter = ....; CriteriaBuilder ...
Iori Yagami's user avatar
0 votes
1 answer
56 views

Select parent and only some fields from child in @OneToMany relationships using JPA and Criteria Builder

Implemented one to many relationship and select parent and child I have a onetomany relationship. Using criteria builder, i need to get parent and all related childs but selecting only some fields ...
SymbolKina's user avatar
0 votes
1 answer
112 views

JPA Criteria - Aliases that does not work on aggregation selection

In a project that uses Hibernate 6.4, I am using the Criteria API provided through Jakarta persistence API (a dependency of Hibernate). However, I encountered a bug while using aliases on aggregation ...
Tydrao_Xalys's user avatar
0 votes
1 answer
71 views

JPA Criteria API join with subquery

Say I have 3 classes class Student { @Id private Long id; private String name; @ManyToOne(mappedBy = "student") private Set<TestResult> testResults; @OneToOne(mappedBy = &...
NganCun's user avatar
  • 185
0 votes
0 answers
43 views

JPA criteria select multiple fields from subquery

I have the following SQL query that I'm trying to write using Criteria JPA. select op3.* from operator op3 where (op3.mp, op3.date_to, op3.date_from) in (select op.mp, op.date_to, op.date_from from ...
user3052078's user avatar
0 votes
0 answers
10 views

JPA criteira api for '@>' function

How to convert this query in JPA criteria api SELECT * from conditions WHERE value @> '[6,6]' @> means contains. More info: https://www.postgresql.org/docs/9.3/functions-range.html My ...
404NotFound's user avatar
0 votes
0 answers
31 views

Implementing OR condition on jpa criteria join

I am creating a spring boot application and I want to implement an or condition in a JPA Criteria query such that the resulting query consists of: INNER JOIN CUSTOMER c ON t1.CUSTOMER_ID = c....
user14773854's user avatar
0 votes
0 answers
62 views

JPA Jakarta Criteria Specification API. Issue with getting distinct column with other columns

I am having criteria api implemented for search filters, Now there is one filter which needs to filter ids which are not part of particular group. Now issue is the table which hold this data is having ...
user9160172's user avatar
0 votes
0 answers
36 views

OpenJPA Criteria API - createCriteriaUpdate and createCriteriaDelete

I'm using OpenJPA 3.2.2 and trying some CRUD by OpenJPA - criteria API but got some errors Exception in thread "main" java.lang.UnsupportedOperationException: JPA 2.1 at org.apache....
Rich Le's user avatar
  • 11
0 votes
0 answers
39 views

Predicate to find collection that contains a value

I have an entity that has an collection of String: @Entity class A { @Column private Set<String> coll; } The sql to create the table is the following: create table a ( coll varchar(10)...
elcye's user avatar
  • 167
1 vote
1 answer
184 views

JPA Criteria API not working in JPARepository queries

I'm trying to perform query using JPARepository with Criteria API, but it seems like method in repository is just ignoring specification passed to it. Here's my repository interface: public interface ...
wazzupek01's user avatar
0 votes
0 answers
38 views

QueryDSL Issue: Filtering Nested Collections in Spring Boot with One-to-Many Relationship

I'm working on a Spring Boot project using QueryDSL for database queries. In my application, I have three classes: ClientGroup, Client, and ClientBook. The ClientGroup class has a one-to-many ...
ajafov98's user avatar
0 votes
0 answers
22 views

Join a table with CriteriaBuilder and an additional parameter seems to have no effect

I have two entities that are structured as follows @Entity @Table(name = "Person") public class Person { @EmbeddedId private PrimaryKey personPK = new PrimaryKey(); @Column(name = ...
sylo's user avatar
  • 205

15 30 50 per page
1
2 3 4 5
58