Reputation: 747
I am working on a project involving struts2 and hibernate.Actually I want to execute the select query below and store the values into a object of type Users.i tried using tostring(),querystring() methods all return only the query asa string.I tried googling it said "HQL returns result in the form of objects" but i cant get the members of the class using query.how to get it please help thanks in advance
Query query=session.createQuery(" from Users where userid=:temp");
query.setParameter("temp", "kumar");
Upvotes: 0
Views: 1508
Reputation: 47280
List<User> users = query.list();
looks like it should work (assuming your tables and entities are set up). You could also use a criteria.
Upvotes: 1