]
Carl Allain commented on HHH-3139:
----------------------------------
Also, we nailed down the problem to what is shown in the description, although our hql
request is much more complicated.
select elements(collection) does not return all composite key
segments when used in subquery
--------------------------------------------------------------------------------------------
Key: HHH-3139
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3139
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.4
Environment: HB 3, Oracle 10g
Reporter: Carl Allain
Priority: Blocker
When dealing with collection of entities having composite keys, elements() seems to
return all key segment columns, which seems fine.
So, in our case (CountrySubdivision has a composite PK, :CTRSD_CD + CTR_ISO_CD), when we
do
select elements(mks.countrySubdivisions) from MarketSegmentPdo mks
it gives this:
select
countrysub1_.CTRSD_CD as col_0_0_,
countrysub1_.CTR_ISO_CD as col_0_1_
from
MKSG_MKS marketsegm0_,
MKSG_MKSCTRSD countrysub1_
where
marketsegm0_.MKS_NRI=countrysub1_.MKS_NRI
while using the same elements() function construct in a subquery, only one PK segment is
included by Hibernate!. So:
from CountrySubdivisionPdo cs where cs.id in (select elements(mks.countrySubdivisions)
from MarketSegmentPdo mks)
gives this:
select
countrysub0_.CTRSD_CD as CTRSD1_65_,
countrysub0_.CTR_ISO_CD as CTR2_65_,
countrysub0_.CTRSD_TS as CTRSD3_65_
from
PLGE_CTRSD countrysub0_
where
(
countrysub0_.CTRSD_CD, countrysub0_.CTR_ISO_CD
) in (
select
countrysub2_.CTRSD_CD <---------------------------------- WHERE is
CTR_ISO_CD???????
from
MKSG_MKS marketsegm1_,
MKSG_MKSCTRSD countrysub2_
where
marketsegm1_.MKS_NRI=countrysub2_.MKS_NRI
)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: