-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help in querying index-many-to-many
PostPosted: Thu Sep 02, 2004 5:46 pm 
Newbie

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>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.