Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to add the result to list  RSS feed

 
rakesh kopperapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
List prod_uid=getPersistenceEngine().retrieve(Criteria.PRODUCT_ID_SELECTED,new Object[] {path});
for(int i=0;i<prod_uid.size();i++){
result = getPersistenceEngine().retrieve(Criteria.PRODUCT_DESC_PART_SELECTED, new Object[] {prod_uid.get(i)});
}

here i am getting product ids in a list i.e prod_uid
i am passing this as a parameter in the next query in for loop
suppose if there are 10 product ids are present in the list means
in result also 10type of contents shpuld be there,in debugging mode they are coming,but related to last id products are coming.
so i understand that,i have to add the result to another list,but i am getting null pointer exception can any body help me
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NullPointerExceptions are more of a beginner's topic.

Please post more details, including the stack trace and which line is actually throwing the Exception.
If it really is from that snippet it is either your persistence engine or the prod_uid List which is null.
Insert a few print statements in that codeAnd please find the code button to maintain indentation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!