LoadQueryJoinAndFetchProcessor - wrong alias for OrderBy

Description

wrong alias for order by statement is substituted in org.hibernate.loader.plan.exec.internal.LoadQueryJoinAndFetchProcessor#processCollectionFetch, collection table alias is used instead of element table alias

this cause exception if
org.hibernate.Session.get(B.class, <idvalue>); is executed

org.h2.jdbc.JdbcSQLException: Column "CS1_.NAME" not found; SQL statement:
select b0_.id as id1_2_0_, b0_.name as name2_2_0_, cs1_.B_id as B_id1_2_1_, c2_.id as cs_id2_3_1_, c2_.id as id1_4_2_, c2_.name as name2_4_2_ from B b0_ left outer join B_C cs1_ on b0_.id=cs1_.B_id left outer join C c2_ on cs1_.cs_id=c2_.id where b0_.id=? order by cs1_.name [42122-168]

org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader with org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader is used

Environment

Linux 3.13.5-1-ARCH x86_64 GNU/Linux, Java(TM) SE Runtime Environment (build 1.7.0_45-b18), Hibernate 4.3.1.Final, h2database 1.3.168

Assignee

Gail Badner

Reporter

Peter Kotula

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure