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