I have a query like so (in queries.xml):
Code:
select rec from Request rec
left outer join rec.approvals
where rec.submitter.badgeNumber = :employeeBadge
or rec.requester.badgeNumber = :employeeBadge
order by rec.dateSubmitted desc
And when I get the result list and try to iterate through it, I get:
java.lang.ClassCastException: org.aero.libreq.entity.RequestEntity cannot be cast to [Ljava.lang.Object;
Here's my java (error occurs on this line: Object[] objects = (Object[])iterator.next();):
Code:
public List<Request> toModelList(Collection<RequestEntity> entityList) {
List<Request> modelList = new ArrayList<Request>();
Iterator iterator = entityList.iterator();
while (iterator.hasNext()) {
Object[] objects = (Object[])iterator.next();
RequestEntity entityObject = (RequestEntity)objects[0];
Request modelObject = toModel(entityObject);
modelList.add(modelObject);
}
return modelList;
}
While stepping through the method, the entityList is passed in as an ArrayList<E> with elementData=Object[3360] and each element is a RequestEntity.
What am I missing here?
Thanks!