Conflicting aliases when properties have same name and different types in inheritance.

Description

A Hql-Query leads to a DB2 Error (Error-Code -415). This happens with the following mapping:

In the sample testcase - that I added - there is an abstract superclass (AEntity) with two subclasses (BEntity, CEntity). BEntity has two numeric fields A and B. CEntity has two string fields B and C. When querying the HQL "from hibernate.testcase.inheritance.AEntity" this leads to the DB2-Error -415 (SQL0415N The data types of corresponding columns are not compatible in a fullselect that includes a set operator or in the multiple rows of a VALUES clause of an INSERT or fullselect.).

Here is the resulting SQL:

select aentity0_.Oid as Oid0_, aentity0_.A as A1_, aentity0_.B as B1_, aentity0_.B as B2_, aentity0_.C as C2_, aentity0_.clazz_ as clazz_ from ( select B, nullif('x','x') as C, Oid, A, 1 as clazz_ from springma.B union all select B, C, Oid, nullif(0,0) as A, 2 as clazz_ from springma.C ) aentity0_

In the union all both columns B are mapped into the same selection column. This is a type conflict.

Environment

Hibernate 3.2.6, DB2 9.5 LUW on Solaris

Assignee

Unassigned

Reporter

Ludger Springmann

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure