The "good" hql goes like this:
--------------------------------
select person, name, domizilOrt, sitze, from ch.abraxas.steuer.businesscomponent.register.persistency.struct.GenJuristischePersonInfo as person left join person.nameInfos.elements as name left join person.postAdressenKontaktInfos.elements.postAdressenInfos.elements.einfachePostAdresseInfo.standortInfo.ortInfo as domizilOrt left join person.sitzInfos.elements as sitze where name.gueltigVon <= :today1 and name.gueltigBis >= :today2 and name.name like :name
The "bad" hql goes like this:
--------------------------------
select person.integerID, name, domizilOrt, sitze, from ch.abraxas.steuer.businesscomponent.register.persistency.struct.GenJuristischePersonInfo as person left join person.nameInfos.elements as name left join person.postAdressenKontaktInfos.elements.postAdressenInfos.elements.einfachePostAdresseInfo.standortInfo.ortInfo as domizilOrt left join person.sitzInfos.elements as sitze where name.gueltigVon <= :today1 and name.gueltigBis >= :today2 and name.name like :name
The only difference is the person.integerID (which is a normal property mapped in the hbm.xml). The result is incorrectly generated SQL (seems to me, at least), which (in excerpts) goes like:
select nameinfos1_.ID_NAME as ID_NAME0_, ..., postadress4_.FK_EINFACHEPOSTADR as FK_EINF11_1_, ..., sitzinfos8_.FK_JURISTPERSON as FK_JURI12_2_, ..., genjuristi0_.PF_ABSTRAKTEPERSON as x0_0_, nameinfos1_.ID_NAME as x1_0_, postadress4_.ID_POSTADRESSE as x2_0_, sitzinfos8_.ID_SITZ as x3_0_, as x4_0_ from EN2B.T34JURISTPERSON genjuristi0_ inner join EN2B.T34ABSTRAKTEPERSON genjuristi0__1_ on genjuristi0_.PF_ABSTRAKTEPERSON=genjuristi0__1_.ID_ABSTRAKTEPERSON left outer join EN2B.T34NAME nameinfos1_ on genjuristi0_.PF_ABSTRAKTEPERSON=nameinfos1_.FK_ABSTRAKTEPERSON ... (more left outer joins) ... where postadress2_.COD_TABELLE = 'ADR' and ((nameinfos1_.AK_GUELTIGVON<=? )and(nameinfos1_.GUELTIGBIS>=? )and(nameinfos1_.NAME like ? ))
The problem is before "as x4_0_".
Thanks for the help,
J
|