-->
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.  [ 4 posts ] 
Author Message
 Post subject: Collection inside Collection
PostPosted: Sun Apr 30, 2006 10:17 am 
Newbie

Joined: Sun Apr 30, 2006 9:52 am
Posts: 2
Hi all!

Does anyone know a way of Mapping a Collection that holds a Collection as its value:

My problem:

I need something like that Map<Objec,Set<Object>>

is this possible, and if, how?

thx

michael

// edit: noob question or just no answer?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 12:08 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
No, as far as I'm aware, you'd have to make an intermediate class, though if you have the DB shape to model Map<Object, Set<Object>>, then the mapping pretty much writes itself. You'd just end up with Class1 containing a Map<Object, Class2>, and Class2 only has two members: its id (being the map-key from Class1) and the Set<Object> that you really wanted to map.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 9:33 am 
Newbie

Joined: Sun Apr 30, 2006 9:52 am
Posts: 2
thx for your answer!

Thats exactly how i solved that problem so far. i only wanted to know if there is a better solution. it doesnt seems so, but i can live with that.
thx for your( the only ) answer.

greets

pyradonis


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 6:12 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
On the plus side, this way of mapping means that the set is cached separately from the map, as they're in separate objects. So if one changes, the other one isn't invalidated in the cache. This solution has performance benefits.

Cloud. Silver lining. Voila!

_________________
Code tags are your friend. Know them and use them.


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