-->
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: Search on property of <composite-id>
PostPosted: Tue Oct 26, 2004 5:58 am 
Newbie

Joined: Mon Feb 02, 2004 4:18 pm
Posts: 16
It seems replies are directly proportional to the amount of code in the title...

I've mapped a table with a composite key to ensure that rows are unique, but I often need to search on only one element of the key. How is this possible in hibernate?

ie. I've got a display item and a priceIndex which makes each display price unique, but I need to search for all prices for each display, so I can't search by primary key.

The only other solution is to create an arbitary key, which I'm keen to avoid. How have other people gotten around this problem?

here is the section of the mapping file

<composite-id class="ElementPricePK" name="Id">
<key-property column="PRICE_INDEX" name="PriceIndex" type="integer" />
<key-many-to-one class="ElementDisplay" column="DISPLAY_ID" name="display" />
</composite-id>

But I need to search by ElementDisplay on this table.


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.