I have occured a situation in which i have to reprsent the java bean object which can help me to populate the data to jsp and to database when i am saving the data back to database . The situation is like this
i have one set of data in left side and i have multiple set of data in right hand side and this right hand side data is again have some muliple set of data so now i have to do some mapping so that i can display each set of data . i am going to use some collection object like Hashmap to do such mapping but i am still not sure how i can do that . if i reprsent this situation it would be like this
Set of Data ------------- Multiple Data - Muliple Data
or like this Data0 ------ Data 1 and Data 1 has inside some data
so anybody who has good knowledge of data structure , can really help me .
i hope u must have got my problem . if u still did not get my problem i will pass the screen shot to you. Please help this is quite urgent .
Sounds like you have two serial one-to-many tables.
On each table you could use the one side as a key to a Hashmap and the other side as a set of values in another set of hash maps. Could be a bit tricky to keep track of what class each value represents!
e.g. Animal -> dog/cat/mouse -> names. -> weight. So starting from the right hand side,
set up a hash map of all dogs' name/weight key/value pairs - call it dogs set up a hash map of all cats' name/weight key/value pairs - call it cats set up a hash map of all mice's name/weight key/value pairs - call it mice
Then set up a hash map containing Animal/dogs, animal/cats and animal/mice key/value pairs.
I hope this helps.
The nice thing about Standards is that there are so many to choose from!
Joined: May 03, 2004
Thanks Eddie , you have given me the right clue for this problem , i wil try to implements this way but only drawback i see with this approach is this become quite strong coupling b/w others .Is there any other way out using some other collection classes and anyway i am going to check with this way first .Thanks for the nice clue .