• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i assign the returned list from hibernate like this

 
Amith Bhavikatti
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my method in which i call hibernates through EJB and assign that list of database values from the HQL to a class called AssignmentByLetter where getters and setters are there for all the values which are coming from the database and residing in list.
It is giving java.lang.ClassCastException..
Please help me out..
This is my code
[code]
public List getAllAssignmentByLetter()
{
assignmentByLetterList = new ArrayList();
try {
logger.debug("getAllAssignmentByLetter");
List list = taskSession.getAllAssignmentByLetter();
logger.debug("After getting from Hibernates"+ list.size());
for (Iterator iter = list.iterator(); iter.hasNext() {
logger.debug("Inside Iterator Loop"+ iter.next());
AssignmentByLetter assign = (AssignmentByLetter) iter.next();
assign.setStartValue(assign.getStartValue());
assign.setEndValue(assign.getEndValue());
assign.setCollector(new Collector(assign.getCollector().getCollectorID()));
assign.setGroup(new Group(assign.getGroup().getGroupID()));
assignmentByLetterList.add(assign);
}
}
catch (Exception e) {
logger.error(e.getMessage());

}
return assignmentByLetterList;
}
[\code]

Thanks in Advance
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't post the same question in multiple forums.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic