can someone please give me solution to this problem........
I have two tables; 1) User, 2) Address with a one-to-many relation (a User can have many addresses). I declared a list in User mapping. But when I call user.getAddressList(), the first element in the list is always null.
For example, if I have 5 Address records, when I call user.getAddressList(), I am getting a List of size=5. But the first element in the list is null and the remaining 4 elements are valid records.
The Code in Struts Action: ===========================
Session s = getSession(); Criteria c = s.createCriteria(SmartUser.class); List userList = crit.list();
// Session committed and closed here // List object put in HttpServletRequest
Following code is in the jsp =================================
// Get the userList from request
for(int i=0; i<userList.size(); i++) { SmartUser user = (SmartUser) userList.get(i); List cardList = user.getCardListByOwnerUser(); // In this list, always first element is null for (j=0; j<cardList.size(); j++) { Card card = (Card) cardList.get(j); System.out.println("Card="+card); } }
For example, if I have 5 Card records, when I call user.getCardListByOwnerUser(), I am getting a List of size=5.
when I call user.getCardListByOwnerUser(), the first element in the list is always null.
But the first element in the list is null and the remaining 4 elements are valid records.