• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to do this?

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to learn criteria and I want to execute something like

select deptno from dept; //get all deptno

Criteria criteria = session.createCriteria(Dept.class);List objects = criteria.list(); // this is returning all the rows-- deptno and deptname.

Is there a way I can specify in the criteria that its should only fetch all the depno and ignore deptnames?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You need to use HQL if you want to select individual fields.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic