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?