[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2575?page=c...
]
Mike Hoeffner commented on HHH-2575:
------------------------------------
The original examples would be clearer if I didn't show them as using the same
"foo" table. These are not realistic queries but adding joins and where clauses
would only distract from the part that matters.
Incorrect results. Those from b will be "overshadowed" by those from a:
{code}
select a.name, a.seq, b.name, b.seq from apple a, banana b;
{code}
Proper results:
{code}
select a.name as a_name, a.seq as a_seq, b.name as b_name, b.seq as b_seq from apple a,
banana b;
{code}
Query results are mapped to object array incorrectly when there is
column ambiguity and aliases are not used
------------------------------------------------------------------------------------------------------------
Key: HHH-2575
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2575
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.2.2
Environment: Hibernate 3.2.2 + MySQL 5.0.22 + MySQL Connector/J 5.0.5.
Reproduced with HSQLDB 1.8.0.7.
Reporter: Mike Hoeffner
Priority: Minor
Attachments: ResultsNotEffectedByAliasesTest.java
I had a SQL (not HQL) query that basically looked like this:
select a.name, a.seq, b.name, b.seq from foo a, foo b;
and I noticed that the results obtained through list() -> (Object[]) get(i) ->
row[0], row[1], row[2], row[3]
did not correspond to what I saw when manually running the query without Hibernate
involved. row[2] always had the same values as row[0] and row[3] always had the same
values as row[1].
When I tried adding aliases so that it became:
select a.name as a_name, a.seq as a_seq, b.name as b_name, b.seq as b_seq from foo
a, foo b;
then the results matched what I expected. So having aliases in the SQL modified the
results that were returned even though I was looking up the value from each column by its
index / position instead of by its name / alias.
Attached is a test case that will reproduce this.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira