Issue Details (XML | Word | Printable)

Key: HHH-2257
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Steve Ebersole
Reporter: Milan Pecko
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

Query.iterate() results differ from Query.list() 2

Created: 21/Nov/06 08:44 AM   Updated: 08/Dec/06 04:46 AM
Component/s: query-hql
Affects Version/s: 3.2.0.ga
Fix Version/s: 3.2.2

Time Tracking:
Not Specified

File Attachments: 1. Java Source File Portfolio.java (23 kB)
2. Java Source File Subject.java (35 kB)

Environment:
Hibernate 3.2.0 ga, ASTQueryTranslator,
Sun Java 1.5.0-06, Windows XP
Issue Links:
Duplicate
 


 Description  « Hide
I saw the problem with the same description(HHH-1946) but my problem occurs with hibernate 2.1.8 too.

The problem is a differnet number of results:
HQL : "select p.id,p.client from Portfolio as p"
SQL produced by list() :
"select portfolio0_.portfolioId as col_0_0_, portfolio0_.clientId as col_1_0_, subject1_.subjectId as subjectId194_, subject1_.name as name194_,... from PORTFOLIO_TBL portfolio0_ inner join SUBJECT_TBL subject1_ on portfolio0_.clientId=subject1_.subjectId"

SQL produced by iterate() :
 "select portfolio0_.portfolioId as col_0_0_, portfolio0_.clientId as col_1_0_ from PORTFOLIO_TBL portfolio0_"

when i changed HQL to : "select p.id,p.client.id from Portfolio as p"
the number of results is the same.
both functions produce the same SQL:"select portfolio0_.portfolioId as col_0_0_, portfolio0_.clientId as col_1_0_ from PORTFOLIO_TBL portfolio0_"





I dont know what resultset is correct "ids includes ids with client equals to null" or "ids with client only" but i think the number of result should be tha same for same HQL.










 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Steve Ebersole added a comment - 05/Dec/06 12:37 PM
Can you confirm that p.client refers to a many-to-one or one-to-one association?

In the future, the appropriate mappings are usually needed to correctly diagnose problems. At the very least I need the context of the issue.

Milan Pecko added a comment - 06/Dec/06 02:43 AM
Yes, p.client refers to a many-to-one assotiation with "Subject"

Milan Pecko added a comment - 06/Dec/06 02:45 AM
there is source code including h2 x-doclet and h3 annotations

Steve Ebersole added a comment - 06/Dec/06 07:08 AM
Right, so then this should be fixed in SVN. please verify...

Steve Ebersole added a comment - 06/Dec/06 07:09 AM
trunk / 3.2

Milan Pecko added a comment - 08/Dec/06 04:46 AM
seems to work fine now, thanks