Hi,
I am trying to select a single column value from the table but i am getting the following exception .
This is a console based application and back end as MYSQL 5.0.
And java version as jdk1.4 and Hibernate version as Hibernate 3.0.
I have written query like this
bean app=new bean();
query="select mag.eno from bean mag";
q=session.createQuery(query);
for(Iterator it=q.iterate();it.hasNext();)
{
app=(bean)it.next();
System.out.println(app.getEno());
}
but i m getting error like this in the console
org.hibernate.impl.SessionFactoryImpl@5b8827
SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
Inserting Record
Hibernate: select bean0_.no as col_0_0_ from mag bean0_
Hibernate: select bean0_.no as col_0_0_ from mag bean0_
error:java.lang.ClassCastException
Help me
|