Hello
Thank you, the Hibernate community, for the anser to my last question.
Now I discover another problem but I did not find answer for this case on the internet:
I have an entity class, say 'MyEntity', with is related to several entities (it is aggregated by class 'Groupe', the class 'History' relates two MyEntity instances, ....).
What i would like to do is a sorted list ('paginated' means getting result from N to N+100) of MyClass instances, with the all related instances loaded (not lazy).
First, I try this criteria:
session.createCriteria(MyEntity.class).
setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).
setMaxResult(100).
It works OK when my database size is small (less than 100)
When the database size is bigger than 100,
the result list is imcomplete !
If I set the max result 100, I get 2 results,
if I change max result to 1000, I get 10 results, .......
It seems that Hibernate applies
the size limitation to the duplicated list BEFORE
filterring the duplicated elements.
That is why I get less than 100 results.
Could you please help me ?
Thank you !
Hibernate version: 3.2.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Criteria criteria = session.createCriteria(MyEntity.class); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.setMaxResults(100);
Full stack trace of any exception that occurs:
Name and version of the database you are using: MySQL 5
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|