Top "Criteria-api" questions

This tag is for questions related to the Java Persistence Criteria API (from JPA 2.0) which is used to define queries through the construction of object-based query definition objects, rather than use of the string-based approach of the Java Persistence query language.

EntityManager.find can't find entity, but using the Criteria API does

I've encountered a rather odd case in Java EE 6 where using the JPA EntityManager's find method along with an entity's …

hibernate jakarta-ee jpa-2.0 java-ee-6 criteria-api
Criteria Builder Create new Object In Select Statement

I was wondering if it's possible to create such query like : em.createQuery( "SELECT NEW EmpMenu(p.name, p.department.…

java hibernate jpa-2.0 jpql criteria-api
Mock a JPA CriteriaBuilder with Mockito

I have a particularly nasty JMock checking() block for a JPA query that I want to migrate to Mockito: Mockery …

java jpa mockito criteria-api jmock
JPA 2 No explicit selection and an implicit one cold not be determined

I am trying to fetch all users for a folder where the user was created after a certain date. the …

jpa-2.0 criteria-api
OpenJPA criteriaBuilder nested object property fetch

Is there any way in OpenJPA to get hold of a nested object property via CriteriaBuilder? Here's a small case. @…

java criteria-api openjpa
JPA Criteria API: How to select property in nested collection

I have a class Customer and CustomerDependant entities. Customer has many to many bi-directional relationship with its dependents. I need …

java jpa-2.0 criteria-api
Creating queries using Criteria API (JPA 2.0)

I'm trying to create a query with the Criteria API from JPA 2.0, but I can't make it work. The problem …

java jpa jpa-2.0 criteria-api metamodel
Grails Criteria projections on joined table

I have an issue with grails criteria builder, I want to do a projection on a column that is on …

grails alias projection criteria-api
JPA Criteria select all instances with max values in their groups

Is there a way to write with JPA 2 CriteriaBuilder the equivalent of the following query? select * from season s1 where …

jpa jpa-2.0 criteria-api correlated-subquery
Using the 'case...when...then...else...end' construct in the 'having' clause in JPA criteria query

The following criteria query calculates the average of rating of different groups of products. CriteriaBuilder criteriaBuilder=entityManager.getCriteriaBuilder(); CriteriaQuery<…

hibernate jpa criteria criteria-api having