[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3139) select elements(collection) does not return all composite key segments when used in subquery

Carl Allain (JIRA) noreply at atlassian.com
Thu Feb 28 12:49:33 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29623 ] 

Carl Allain commented on HHH-3139:
----------------------------------

This sentence in the documentation makes it unclear in our case, since we're really using it in a where clause (indirectly through a subquery)?

> 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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list