1

I used createCriteria() and setFetchMode() methods to join and select. I don't need all columns so I want to select specific columns to improve performance, but I can't find how to do it. Maybe should I use HQL instead?

Sanghyun Lee
  • 21,644
  • 19
  • 100
  • 126

1 Answers1

6

You will need to set Projection on specific properties.

Example:

 criteria.setProjection( Projections.projectionList()
    .add( Projections.property("cat.name"), "catName" )
    .add( Projections.property("kit.name"), "kitName" )
 );
Alex Gitelman
  • 24,429
  • 7
  • 52
  • 49