-->
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.  [ 5 posts ] 
Author Message
 Post subject: mapping a dictionary in a dictionary?
PostPosted: Tue May 01, 2007 9:20 am 
Beginner
Beginner

Joined: Thu Apr 19, 2007 5:37 am
Posts: 28
I can't seem to find a way to map something like this:

Code:
IDictionary<DateTime, IDictionary<string, Contract.MonthsAttributes>> underlyingContracts


Is there a simple way to do this? Am I missing something?

Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 01, 2007 1:28 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Im not sure if you can map it exactly like that. I do know that you can map a collection of objects that have thier own collection though. So you would have an object like this:

Code:
public class ContractDate{

  public DateTime Date{...}
  public IDictionary<Contracts> UnderlyingContracts{...}
}


Then map a Dictionary of ContractDates to another entity and then you will almost get what you are looking for.

I dont know the underlying reasons why you need a dictionary of a dictionary so maybe this will work for you and maybe not.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 5:42 am 
Beginner
Beginner

Joined: Thu Apr 19, 2007 5:37 am
Posts: 28
unfortunately, I need to have a dictionary in a dictionary, for efficient access to the data.

So isn't there any way to do that with Hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 7:39 am 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
pejvan wrote:
unfortunately, I need to have a dictionary in a dictionary, for efficient access to the data.

So isn't there any way to do that with Hibernate?


pejvan, why did you reject the provided solution and state that it won't work because of efficiency? In truth the provided solution should be just as efficient (or close enough to be irrelevant) to what you had requested. You will still have a dictionary with a containing dictionary. The access methods would be the same. Your hash would be on the same objects.

I think you dismissed the provided answer way too fast. If there is another reason besides efficiency, then maybe your answer makes sense. Otherwise, I would recommend trying the given solution.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 9:40 am 
Beginner
Beginner

Joined: Thu Apr 19, 2007 5:37 am
Posts: 28
Indeed, I might have been through the reply to quickly and I will a second thought on it!!!
Thank you both for pointing me a solution, and also for pointing me that I had dismissed it too quickly

I'll have to give it a try early next week, and will let you know.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

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.