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

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Jan 23 07:18:44 EST 2007


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

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

    Fix Version: 3.3
      Assign To: Steve Ebersole
       Priority: Minor  (was: Critical)

initially scheduling this for 3.3 because my gut tells me this will need the SQL rendering changes targetted for 3.3 to resolve this issue.  This may get moved up to 3.2.3 or 3.2.4 if that is found to not be the case.

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

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