Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Criteria-API issue with

I have an entity (DbList) with a List<String> element collection (contents) that is lazily fetched.
 
I'm trying different ways to load the collection of all entities and eagerly load contents - JPQL and the Criteria API - with or without a firstResult / maxResults.
 
I'm getting the right number of entities whenever I use JPQL.
When I use the Criteria API - I get the right number of entities when using firstResult / maxResults.
When I use the Criteria API and an unlimited result set (don't set firstResult/maxResults), then I get the wrong amount of entities back unless I explicitly add a distinct(true) to the CriteriaQuery.
 
I've attached DbList and Test - this is working but you'll see how I had to add the distinct call to the Criteria "all" case to get it to work.
Add distinct on the result limiting run causes it to fail.
 
Is this a bug or do I not have my Criteria built correctly?
 
BTW - this is failing the same way on Oracle, H2 and Derby and I have a small project setup if that helps...
 
 

Attachment: DbList.java
Description: Binary data

Attachment: Test.java
Description: Binary data


Back to the top