Hi aditee,
It seems you are facing N+1 problem in iBatis...Which is fully solvable
Below code snipet will solve your problem
This is from iBatis Developer guide
myList is a List of beans containing type
"com.ibatis.example.Category". Each object in that List will have a "productList" property that is also a List
populated from the same query, but using the "productResult" result map to populate the beans in the child
list. So, you end up with a list containing sub-lists, and only one database query is executed and both child and parent list are get popultaed as expected..
Cheers,
Dhananjay