Table aliases constructed incorrectly from HQL when JOIN is used when selecting multiple objects

Description

When constructing a query to retrieve a "cross" join (cartesian product) of multiple objects and a JOIN is used, the table aliases for the cartesian objects are misplaced during query translation:

Example:

SELECT
p, c, u
FROM
Practice p,
Publication c,
UserGroup u
JOIN
p.locations AS l
WITH l.practice = p

Results in a translated SQL query of:

select
practice0_.practice_id as practice1_54_0_,
publicatio1_.publication_id as publicat1_56_1_,
usergroup2_.usergroup_id as usergroup1_59_2_,
practice0_.brand_id as brand4_54_0_,
practice0_.practice_nm as practice2_54_0_,
practice0_.active_flg as active3_54_0_,
publicatio1_.admin_flg as admin2_56_1_,
publicatio1_.practice_id as practice6_56_1_,
publicatio1_.usergroup_id as usergroup7_56_1_,
publicatio1_.inbox_user_id as inbox8_56_1_,
publicatio1_.publication_nm as publicat3_56_1_,
publicatio1_.location_id as location9_56_1_,
publicatio1_.visible_flg as visible4_56_1_,
publicatio1_.active_flg as active5_56_1_,
usergroup2_.usergroup_nm as usergroup2_59_2_,
usergroup2_.icon as icon59_2_
from
dbo.practice practice0_
inner join
dbo.location locations3_
on practice0_.practice_id=locations3_.practice_id
and (
locations3_.practice_id=practice0_.practice_id
),
dbo.publication publicatio1_,
dbo.usergroup usergroup2_

Notice how the table aliases for publication and usergroup are incorrectly placed.

Environment

MS SQL Server 2000, JDK1.5, Hibernate 3.2cr3

Status

Assignee

Unassigned

Reporter

RyanR

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.2.0.cr3

Priority

Critical