SizeExpression's toString method outputs misleading results.
The toString implementation assumes that the implementation has the computed size on the LHS whereas toSqlString (and accordingly the op that is passed by the Restrictions.sizeXX methods) is implemented with the computed size on the RHS.
This leads to confusing results for users when printing out criterion.toString values, as they appear to be saying roughly the opposite of what they are being asked to do.
As a user I would expect the following test to pass:
However it fails with:
The lowest impact change would be to alter toString to emit the same order as toSqlString, so the following test would pass: