|
From: Erwan Le G. (JIRA) <no...@at...> - 2006-06-27 08:53:57
|
wrong sql generated against many-to-any association table
---------------------------------------------------------
Key: HHH-1858
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1858
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.1 rc 1
Environment: tested against postgresql 8.1, OracleXE/10Gr, using hidernate3.&.rc1 and hibernate console3.1.0.beta5 (hibernate3.2.0.cr1)
Reporter: Erwan Le Goulven
Specifying a column name different than 'id' in <many-to-any> relation leads to uncorrect hql generated.
<class name="com.lectra.mapgentest.domain.test.manytomany.ItemImpl" table="ITEM" lazy="true" dynamic-update="true">
...
..
<set name="classifs" table="CLASSIFIABLE_CLASSIFS_ITEM" lazy="true" inverse="false">
<key foreign-key="none">
<column name="items_id" index="ITEM_MYTESTIN_IDX" />
</key>
<many-to-any id-type="java.lang.Long" meta-type="string">
<meta-value value="ClassifFolder" class="com.lectra.mapgentest.domain.test.manytomany.ClassifFolderImpl" />
<meta-value value="ClassifAxe" class="com.lectra.mapgentest.domain.test.manytomany.ClassifAxeImpl" />
<column name="classifs_type" />
<column name="classifs_id" />
</many-to-any>
</set>
..
...
</class>
Sample hql triggering error :
from ItemImpl i
inner join i.classifs c
where c.id is not null
Generated sq :
select
itemimpl0_.id as id71_,
itemimpl0_.parent_id as parent2_71_
from
ITEM itemimpl0_
inner join
CLASSIFIABLE_CLASSIFS_ITEM classifs1_
on itemimpl0_.id=classifs1_.items_id
where
classifs1_.id is not null
The same trouble might occur on <any> relation, and the column name resolution is not done when dealing with hql constraints against the "any" side
--
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
|