Joined: Thu Sep 02, 2004 5:31 pm Posts: 4
|
Hibernate version:2.1.6
I am trying to execute a query that uses the key of the Map in the where condition trying to find All partner products that have a choice id of 10.
here is the query
select pp from PartnerProduct pp, pp.products.choices.indices choices
where choices.id = 10
The query formed by hibernate does not give the desired results. The where condition formed uses the choice_value_id column instead of the choice_id column
Any help will be greatly appreciated.
Mapping info
<class name="PartnerProduct" table="PARTNER_PRODUCT">
<cache usage="read-write" />
<id name="id" type="long">
<column name="PARTNER_PRODUCT_ID" length="22" not-null="true"/>
<generator class="sequence"/>
</id>
<many-to-one column="PARTNERSHIP_ID" class="Partnership" name="partnership" cascade="none" not-null="true" insert="true" update="true"/>
<many-to-one column="PRODUCTS_ID" class="MultiSelect" name="productsMS" cascade="none" not-null="false" insert="true" update="true"/>
</class>
<class name="MultiSelect" table="MULTI_SELECT">
<cache usage="read-write" />
<id name="id" type="long">
<column name="MULTI_SELECT_ID" length="22" not-null="true"/>
<generator class="sequence"/>
</id>
<map name="choices" table="MULTI_SELECT_CHOICE_VALUE">
<key column="MULTI_SELECT_ID"/>
<index-many-to-many column="CHOICE_ID" class="Choice"/>
<many-to-many column="CHOICE_VALUE_ID" class="ChoiceValue"/>
</map>
</class>
|
|