-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping Collections of Collections?
PostPosted: Fri Jun 23, 2006 6:23 am 
Newbie

Joined: Thu Jun 22, 2006 5:13 am
Posts: 1
It's looking to me like the answer is "no", but is there any way to map nested collections?

My data structure looks like this:

Code:
LinkedHashMap<Integer, Set<String>> mappedSet = new LinkedHashMap<Integer, Set<String>>();


Can that be mapped as is or should I instead find a way to decompose into simpler Java objects?

Thanks Much,
David


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 8:07 am 
Regular
Regular

Joined: Wed Jan 11, 2006 12:49 pm
Posts: 64
Location: Campinas, Brazil
I am no expert, but as far as I know you can only make a mapping of keys (String, Number and subclasses) to mapped entities. java.util.Set is not an entity, so my immediate answer would be no. However, you can make a mapped entity implement java.util.Set. Now that would be akward, but anyway...

The other path would be to create an entity with two (or more according to your need) properties: an identifier and a one-to-many relationship. This would be the Set elements' type. I think this looks more elegant than making some entity implement java.util.Set.

_________________
Henrique Sousa
Don't forget to rate useful responses


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.