I need to create a list of map. i.e a map which contain each element as a list.
My problem is listed below.
I have a ListMaster each ListMaster is subdivide into sub-list and sub-list is classified as different type.
My table structure is
LIST_MASTER
Code:
LIST_ID(P) LIST_NAME
L1 Lst1
L2 Lst2
L3 Lst3
SUB_LISTCode:
SUBLIST_ID(P) LIST_ID(FK) SUB_LIST_TYPE
SL1 L1 Type1
SL2 L1 Type1
SL3 L1 Type1
SL4 L1 Type2
SL5 L1 Type2
SL6 L2 Type1
SL7 L2 Type1
SL8 L2 Type2
ListMaster class has a map, which has to store all the sub list keyed by sub list type. So that L1’s (listMaster object which represent ‘L1’) map.get(“type1”) will return all the sublist(SL1,SL2,SL3 ‘L1’) for that particular type – ‘type1’.
Right now what am doing is like get this sublist as a set and writing my on logic to create the map. Is there any way to create the map using hibernate itself. If so please tell me how to write the hibernate-mapping for this?