Note: There is no way to provide exclusions in Hibernate Criteria.
Several other ways of inclusions are below. It is totally your choice.
- One way of doing this is creating a light weight hibernate mapping object with only columns that are required.
- Use HQL to get the columns that you need like this ' Select c.col1,c.col2 from Columns c'
Construct HQL at run time, have a template prepared like below
'Select ' + userDefColumns + ' from Columns c'; // pass the userDefColumns at run time.
As mentioned here