-->
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: Map<String, Map<String, Map<String, String>>&
PostPosted: Mon Oct 30, 2006 10:02 pm 
Beginner
Beginner

Joined: Sat Aug 19, 2006 8:04 pm
Posts: 30
I've been trying to figure out how to do this but i've got nothing so i'm going to ask.

Code:
@Entity
public class DataDictionary  {
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;

    @ReallyCrazyMapThatCouldBeReallyCool
    @IfICouldFigureOutHowToAnnotateIt
    private Map<String, Map<String, Map<String, String>>> dict;
}


That map represents a database, which has a map of tables, which has a map of fields, which has a map of various properties on those fields (description, values etc etc).

database -> several tables -> several fields -> several properties

If anyone wants me to elaborate on what the hell i'm trying to do here, i'll be happy to. it has the potential to be amazing if i can pull it off.

The web framework I'm working with (stripes, stripes.m4cj.org) handles generics so elegantly I've been dying to use it. If you have a nested generic structure like that, in the jsp you can say

<stripes:text name="dataDictionary.dict['tableName']['fieldName']['somePropertyName'] /> and it will know what that is, and wire it up / hydrate it automatically. that is amazing.

so if anyone knows how to map something like this please advise. I'm sure i'm not the only one that has needed to or could benefit from mapping a nested collection.

i'm sure there's a way, hibernate supports any sort of object model i can throw at it right?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 02, 2006 11:13 am 
Beginner
Beginner

Joined: Thu Nov 02, 2006 9:38 am
Posts: 32
Location: Belgium
I think you have to introduce several table mappings for each level of the map. It may be best to come up with reasonable domain concepts for each level or your code will be quite incomprehensible.


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.