File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Getting java.lang.ClassCastException.

Amith Bhavikatti

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
public List getAllAssignmentByLetter()
assignmentByLetterList = new ArrayList();
try {
List list = taskSession.getAllAssignmentByLetter();
logger.debug("After getting from Hibernates"+ list.size());
for (Iterator iter = list.iterator(); iter.hasNext() {
logger.debug("Inside Iterator Loop"+;
AssignmentByLetter assign = (AssignmentByLetter);
assign.setCollector(new Collector(assign.getCollector().getCollectorID()));
assign.setGroup(new Group(assign.getGroup().getGroupID()));
catch (Exception e) {

return assignmentByLetterList;

Thanks in Advance
Joanne Neal

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

Campbell Ritchie

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

And read our naming policy.

Closing thread.
I agree. Here's the link:
subject: Getting java.lang.ClassCastException.
It's not a secret anymore!