views:

28

answers:

2

hi. I would like to query using hibernate given a particulay query string I did it like this:

session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
List<String> result = session.createQuery("Select item_value from cb_items").list();  
session.getTransaction().commit();
session.clear();  
return result;

Is this right? or do i have to substitute the column name with the fields in my pojo/bean and the table name with my pojo/bean name

A: 

I missed the mapping in my hibernate.cfg.xml

cedric
+1  A: 

You have to substitute the column name with the field name, and the table name with the Entity's class name, and follow a little different sytax.

Bozho