*
The moose likes Beginning Java and the fly likes Getting java.lang.ClassCastException. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Getting java.lang.ClassCastException.

Amith Bhavikatti
Greenhorn

Joined: Oct 27, 2006
Posts: 26
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

Joined: Aug 05, 2005
Posts: 3495
    
  13
Don't post the same question in multiple forums.


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
Originally posted by Joanne Neal:
Don't post the same question in multiple forums.


And read our naming policy.

Closing thread.
 
jQuery in Action, 2nd edition
 
subject: Getting java.lang.ClassCastException.