hibernate get unique field result

Posted by cometta on Stack Overflow See other posts from Stack Overflow or by cometta
Published on 2010-04-02T04:46:41Z Indexed on 2010/04/02 4:53 UTC
Read the original article Hit count: 543

Filed under:
|
|
|

i use below to get unique "departmentCode" , but by using distinct, my list only return 'departmentCode' all other fields are not retrieved from table, how to retrieve other fields as well like 'divisionCode' and make sure 'departmentCode' is always unique?

  DetachedCriteria crit = DetachedCriteria.forClass(Company.class);
        crit.setProjection(Projections.distinct(Projections.property("departmentCode")));

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate