-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Maps of Maps or Maps of Lists
PostPosted: Thu Aug 24, 2006 4:19 pm 
Newbie

Joined: Thu Aug 24, 2006 4:10 pm
Posts: 5
Hi,

I'd like to be able to map either of
Code:
Map<Locale, List<Tag>>

or
Code:
Map<Locale, Map<String, String>>

(considering that the potential Tag above class is a simple javabean with two name/value String properties)

Any idea how I could do this, specifically using annotations? Any hint using hbm.xml would be fine too of course ;)

What I have until now is
Code:
    @CollectionOfElements
    public List<Tag> getTags()

... where I added a Locale property to my Tag class, but that's not really satisfying, since it doesn't really reflect the domain reality, and the client code will always need to access the "tags" per Locale anyways.

Thanks for any tip ! Cheers,

greg


Hibernate version:
3.2.0-cr2 + -annotations-3.2.0-cr1


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 4:36 pm 
Newbie

Joined: Thu Aug 24, 2006 4:10 pm
Posts: 5
I forgot to mention that, ideally, I'd like this to map to the following db layout:
Code:
+----------------------------------+------------+--------------+--------+
| owning_entity_guid               | name       | value        | locale |
+----------------------------------+------------+--------------+--------+
| ff8080810d41e763010d41e78f800002 | tag name   | tag value    | fr_CA  |
| ff8080810d41e763010d41e78f800002 | tag name 2 | tag value 2  | fr_CA  |
| ff8080810d41e763010d41e78f800002 | tag name   | value for DE | de_DE  |
| ff8080810d41e763010d41e78f800004 | tag name   | othervalue   | fr_CA  |
| ff8080810d41e763010d41e78f800004 | tag name   | otherVal DE  | de_DE  |
+----------------------------------+------------+--------------+--------+


(+ potentially a generated (not part of my model) pk which is missing in this example)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 28, 2006 1:28 pm 
Newbie

Joined: Thu Aug 24, 2006 4:10 pm
Posts: 5
any idea / suggestion ? ... whistles


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