NOT WORKING!!!!!!!!!!!!!!!!!!!
So, sortBy should be defined as EL-expression, and you can use the following form:
#{'userName'}.
BTW, I've tried your variant with expression string manipulation with mock hibernate session - works ok for me too, strings are delivered properly to criteria building method. Maybe the problem is with criteria-building code itself or Spring provides its own expression factory breaking the code?