Questions tagged [criteriabuilder]
36 questions
2
votes
1 answer
can do this with JPA / Hibernate criteriabuilder
I am working with oracle and using JPA with Hibernate, can we do this with criteriabuilder?
SELECT col1,col2,col3
FROM table(schema.fn_name(param1,param2,param3))
ORDER BY col1,col2;
the query can display other additional field (xyz) as well,…

Aurora
- 81
- 6
1
vote
0 answers
Sorting using two Columns Criteria Builder
I have a requirement in which i need to sort a table on the basis of two columns.
for the first column, all the null values should be at last, without any sort
for the second column, it should be in descending order.
after sorting on the basis of…

saket
- 41
- 2
1
vote
1 answer
How can you specify clause cause statements with JPA Criteria Builder
I need to specify the AS OF SYSTEM TIME follower_read_timestamp() clause cause statement from CockroachDB to my query using Criteria Builder. I need to use Criteria Builder since my queries are dynamically constructed and have a lot of different…

joshuatvernon
- 1,530
- 2
- 23
- 45
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…

Javee
- 71
- 1
- 1
- 8
1
vote
1 answer
Spring JPA CriteriaBuilder not producing correct SQL
I have the following criteria builder statement:
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(TestEntity.class);
Root itemRoot =…

gaetann
- 91
- 1
- 7
1
vote
0 answers
How to INNER JOIN a jsonb column with CriteriaBuilder
I've been researching a while about how can I implement an Inner Join using CriteriaBuilder, but the thing is that one of the arguments which both tables have in commons is located inside a jsonb column, so the question is:
How can I INNER JOIN 2…

Eduardojls
- 11
- 5
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…

Faizan Haidar Khan
- 1,099
- 1
- 15
- 20
0
votes
1 answer
How to get rid of multiple query for join table in criteria builder (aka multiple db calls)
I have a criteriaBuilder code which runs query on three table;
My root table is checkintable which includes also guestId in it and guest table also associated with event table
checkin table: checknid / guestId
guest table: guestId /…

Bianca
- 1
- 1
0
votes
0 answers
Join tables using Jakarta Criteria
I'm trying to do some joins between tables using criteria, but I'm getting the following error:
org.hibernate.query.SemanticException: Attribute [com.amfpromotora.entity.EmprestimosTabelas#tabcodigo(BASIC)] is not joinable
I know that to make the…
0
votes
0 answers
spring boot does not register entities in the depended projects java.lang.IllegalArgumentException: Not an entity
I have base entity
@MappedSuperclass
@EntityListeners({AuditingEntityListener.class})
public class BaseAuditEntity extends BaseEntity {
...
}
and the entity below
package core.entities
@Entity
public class Customer extends BaseAuditEntity {
…

ylmzzsy
- 7
- 2
0
votes
0 answers
CriteriaBuilder query not working with predicate
Building hibernate query using CriteriaBuilder and Predicate as below. I am getting below error when executing this code =>
What am I doing wrong here ?
public List getProductOffersByDateRange(Date startFromDate, Date startToDate,…

alex
- 147
- 1
- 4
- 17
0
votes
1 answer
Error using criteriaBuilder.max() for LocalDate
I am trying to get max date using criteria builder in a subquery.
But I am getting this error Required type: Expression Provided: Expression
Subquery subRoot = criteriaQuery.subquery(LocalDate.class);
…
0
votes
0 answers
Spring Boot 3 JpaSpecificationExecutor::FindBy(~) with Specification and Projection
So I'm trying to use Specification with projection, this is a new feature on Spring Boot 3.
UserRepository repo;
Specification spec;
Page result = repo.findBy(spec, q -> q.as(UserProjection.class).page(pageable));
as viewed…

Riberto Junior
- 171
- 1
- 8
0
votes
0 answers
Spring boot CriteraQuery attribute not found error
I am trying to write CriteriaQuery in Spring boot application
I have Entity class as below
@Entity
@Data
class Student extends BaseEntity implements Serializable{
@EmbeddedId
StudentID id;
@Column(name = "Student_name")
String…

Venkat
- 1
- 1
0
votes
0 answers
how print sql string in debug eclipse
I need to print the sql query with CriteriaQuery. The code is:
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery query = cb.createQuery(Student.class);
......
//other operantion
query.select(from);
…

Doppu
- 433
- 2
- 5
- 14