I would like to query using hib开发者_运维百科ernate 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
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.
I missed the mapping in my hibernate.cfg.xml
精彩评论