-->
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 map
PostPosted: Wed Mar 31, 2004 1:48 pm 
Newbie

Joined: Thu Dec 04, 2003 6:00 pm
Posts: 5
I currently use a <set> construct to hold my one-to-many collection. The hbm code is:

<set name="models" lazy="true" inverse="true" >
<key>
<column name="mf_db_site" />
<column name="mf_db_id" />
<column name="mf_duns_code" />
</key>
<one-to-many class="com.orci.ITSAM.hibernate.Model" />
</set>

I can get the list of models in my java code by calling parent.getModels();
I would like to be able to use a Map collection so that I could search for a single record in my collection, like, parent.getModels().get(someKeyObject);

I've tried to re-write the <set> construct as <map> but it needs an index field. The model records have a composit key of columns model_number and revision_number. How should the <map> construct look? Will hbm2java create a class for the composit index into the map?

Any help sould be appreciated.
David Robison


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.