-->
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: one-to-many/mapping where key is a property/composite column
PostPosted: Thu Oct 25, 2007 3:58 pm 
Newbie

Joined: Thu Oct 25, 2007 3:17 pm
Posts: 8
Using Hibernate 3.2
DB2390

I am trying to map a one-to-many from a column zip_code in a table ZIPCODES to another table SALES with a column key_field_val. The join here is something like key_field_val=zip_code||'%' the column is a weird composite column. I can may the key_field_val to a zipcode property in SALES using a formula and substring however I can not use a "foreign" property ref in the key of my one-to-many nor can I use a formula. I've tried subselects and custom queries but they all seem to want a key that I can not supply since the key is unnatural. My xml is basically:

<bag name="salesCollection" lazy="false">
<key column="zipCode" />
<one-to-many class="Sales"/>
</bag>

I cannot seem to find away around using the key that does not exist, is this not possible? Should I perhaps approach this a different way?

Thanks


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.