| Author |
How to retrieve particular object from criteria list, I do not want object array
|
Bhupendra Dubey
Greenhorn
Joined: May 10, 2011
Posts: 6
|
|
I am getting exception
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; incompatible with com.dto.AppDTO2
at com.action.AppService.main(AppService.java:121)
-----------------------------
code:
List li=criteria.list();
for(Iterator it = li.iterator();it.hasNext();)
{
AppDTO2 appDTO2 =
(AppDTO2) it.next();
System.out.println("ID: " + appDTO2.getCATEGORY());
System.out.println(" Name: " );
}
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
. . . and the iterator is finding an Object[] type object. You are telling it that is a com.dto.AppDTO2 object, and it isn't. Hence the Exception.
|
 |
 |
|
|
subject: How to retrieve particular object from criteria list, I do not want object array
|
|
|