[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1946) Query.iterate() results differ from Query.list().iterator()
Steve Ebersole (JIRA)
noreply at atlassian.com
Tue Dec 5 13:35:04 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1946?page=all ]
Steve Ebersole closed HHH-1946:
-------------------------------
Resolution: Duplicate
the linked issue at least has the query causing the problem...
> Query.iterate() results differ from Query.list().iterator()
> -----------------------------------------------------------
>
> Key: HHH-1946
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1946
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3
> Environment: Hibernate 3.1.3
> Sun JVM 1.5.0_06
> Windows XP
> Reporter: Simon Vos
> Priority: Critical
>
>
> While trying to migrate our code base from hibernate 2.1.8 to hibernate 3.1.3 I came across a weird problem. In one method a hibernate query is created to retrieve some results from the database, I know that there are three corresponding results in the database for this query. The code used for this is:
> rsIterator = query.iterate();
> while (rsIterator.hasNext()) {
> Relationship current = (Relationship) rsIterator.next();
> NaturalPerson person = (NaturalPerson) sess.get(NaturalPerson.class, new Niss(current.getSpouseNiss()).toLong());
> if (person != null) {
> current.setSpouseFirstName(person.getFirstName());
> current.setSpouseLastName(person.getLastName());
> } else
> log.info("No naturalPerson object could be retrieved for the person with niss number " + current.getSpouseNiss().toString());
> relations.add(current);
> }
> In hibernate 2.1.8 this method worked correctly and it added 3 results to the relations object. But while migrating one of my tests failed, because this method returned only 2 results. Then I tried using query.list().iterator() instead of query.iterate() and this gave me the correct three results..
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list