-->
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: Mapping to a Map<String, List<Contact>>...
PostPosted: Thu Nov 23, 2006 12:25 pm 
Newbie

Joined: Thu Nov 23, 2006 12:18 pm
Posts: 7
I need to map a one-to-many relation as a Map<String, List<Contact>>, but i still did not find the solution.

Before the db update i was using the following mapping :
Code:
<class name="person" ....>
...
...
<map name="contacts" table="SP_CONTACT" lazy="false" cascade="all,delete-orphan" inverse="true">
   <key column="SPC_SPR_ID" not-null="true" />
   <map-key column="SPC_SCT_CODE" type="string" />
   <one-to-many class="com.nexo.susan.be.model.Contact" />
</map>
...
...
</class>


To get all the contacts for a person indexed by the contact type in a
Map<String, Contact>

But a change has be done to get multiple contacts for a same contact type,
so we should have Map<String, List<Contact>>.

Is there a way to map this collection using a <map> or do i have to forget this and use HQL request to get the contacts and index them by myself ?

Thanks.
Christophe.


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.