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?
Asked
Active
Viewed 6,230 times
1

Sanghyun Lee
- 21,644
- 19
- 100
- 126
1 Answers
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
-
Do you have any example if joined multiple tables and if we need to return only some columns from each table – Senthil Muthiah Aug 28 '14 at 11:00