boolean needsOrdering = true;
if (startIdx == -1 && endIdx == -1)
{
// Just restrict to >= 0 so we don't get any disassociated elements
SQLExpression indexExpr = exprFactory.newExpression(sqlStmt, sqlStmt.getPrimaryTable(), orderMapping);
SQLExpression indexVal = exprFactory.newLiteral(sqlStmt, orderMapping, 0);
sqlStmt.whereAnd(indexExpr.ge(indexVal), true);
}
else if (startIdx >= 0 && endIdx == startIdx)
{
// Particular index required so add restriction