I was able to specify the Criteria to sort records in my database table. But, some records under certain table fields are blanks. In case that certain fields have null value records, the sorting does not work. How is the situation supposed to be handled:
Code:
Criteria crit = session.createCriteria( User.class );
String sortBy = aSortUsersTO.getSortBy();
String orderBy = aSortUsersTO.getOrderBy();
if ( orderBy.equals( "DESC" ) )
{ crit.addOrder( Order.desc( sortBy ) ); }
else
{ crit.addOrder( Order.asc( sortBy ) ); }
return crit;