[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1819) Invalid SQL generated for mapping with property-ref

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Mar 23 12:50:11 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1819?page=all ]

Steve Ebersole updated HHH-1819:
--------------------------------

    Fix Version:     (was: 3.3)
                 antlr-rework

> Invalid SQL generated for mapping with property-ref
> ---------------------------------------------------
>
>          Key: HHH-1819
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1819
>      Project: Hibernate3
>         Type: Bug

>   Components: query-hql
>     Versions: 3.1.3
>  Environment: Oracle 8.1.7
>     Reporter: Jakub Mendys
>     Assignee: Steve Ebersole
>     Priority: Minor
>      Fix For: antlr-rework

>
>
> Consider mappings:
> 	<class name="MedDRATerm" table="MBROW_MEDDRA_TERMS" mutable="false"
> 		batch-size="50">
> 		<cache usage="read-only" region="dictionary" />
> 		<id name="medDRATermId" type="long" column="TERM_ID">
> 			<generator class="assigned" />
> 		</id>
> 		<map name="termNames" table="MBROW_TERM_NAMES" lazy="true"
> 			batch-size="50">
> 			<cache usage="read-only" region="dictionary" />
> 			<key column="MEDDRA_CODE" property-ref="medDRACode" />
> 			<index column="LANGUAGE_ID"
> 				type="com.roche.dss.meddra.dao.type.LanguageType" />
> 			<element column="NAME" type="string" />
> 		</map>
> 		<property name="medDRACode" column="MEDDRA_CODE"
> 			type="com.roche.dss.meddra.dao.type.MedDRACodeType" />
> 	</class>
> 	<class name="MedDRATermInstance" table="MBROW_MEDDRA_TREES"
> 		mutable="false">
> 		<cache usage="read-only" region="dictionary" />
> 		<id name="medDRATermInstanceId" type="long" column="NODE_ID">
> 			<generator class="assigned" />
> 		</id>
> 		<many-to-one name="medDRATerm" class="MedDRATerm"
> 			column="TERM_ID" fetch="join" not-null="true" insert="false"
> 			update="false" />
> 	</class>
> and a HQL query:
> from MedDRATermInstance i where i.medDRATermInstanceId is not null and i.medDRATerm.termNames[1] like 'headache'
> Having this Hibernate will generate following SQL:
> SELECT ...
>   FROM orcl_gthes.mbrow_meddra_trees meddraterm0_,
>        orcl_gthes.mbrow_term_names termnames2_
>  WHERE meddraterm1_.meddra_code = termnames2_.meddra_code
>    AND termnames2_.language_id = 1
>    AND meddraterm0_.term_id = meddraterm1_.term_id
>    AND (termnames2_.NAME LIKE 'headache')
> Please note that WHERE clause refers to alias meddraterm1_ which is not mentioned in FROM section!!!!

-- 
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