I am new to hibernate and while working on the following program i am getting the
"in expected: item [SELECT item.item_id,item.purchase_id,item.serial from items item]' exception.
try
{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
//Create Select Clause HQL
String SQL_QUERY ="SELECT item.item_id,item.purchase_id,item.serial from items item";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext();){
Object[] row = (Object[]) it.next();
System.out.println("ID: " + row[0]);
System.out.println("Name: " + row[1]);
System.out.println("Amount: " + row[2]);
}
session.close();
}catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
}
I chked it and know tht the query is correct but i am getting the same problem again. can anyone help me?
|