I'm using the following versions:
Eclipse Platform Version: 3.3.1.1 Build id: M20071023-1652
Hibernate Version :
Hibernate version: hibernate-3.2.5.ga
Code:
List <Person> personList = session.createQuery("select person.id,person.name from Person person where person.id='100'").list();
for(int i=0;i<personList.size();i++){
Person per = personList.get(i);
System.out.println("The value of Id is : "+per.getId());
}
I am Using Jdk 5 in my project..
When I execute the hibernate code above I am getting the class cast exception at.
Code:
Person per = personList.get(i);
Here is the exception:
java.lang.ClassCastException: [Ljava.lang.Object;
Another approach which I tried is:
Code:
List personList = session.createQuery("select person.id,person.name from Person person where person.id='100'").list();
for(int i=0;i<personList.size();i++){
Person per = (Person)personList.get(i);
System.out.println("The value of Id is : "+per.getId());
}
Even in this case I'm getting the same exception as above.
Please let me know if anybody had face the same situation and got resolved the issue.
Your help is highly appreciated.
Thanks