Uploaded image for project: 'NHibernate [Moved to GitHub]'
  1. NH-2940

OracleDialect creates wrong sql using SetFirstResult with criteria queries

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects versions: 3.2.0.GA
    • Fix versions: 3.3.0.CR1
    • Components: Core
    • Labels:
      None
    • Sprint:

      Description

      Setting first result and max results on ICriteria creates a wrong sql which does not return any results.

      Example:

      crit.SetFirstResult(400).SetMaxResults(100)

      will result in the following query

      SELECT *
      FROM (SELECT row_.*, ROWNUM rownum_
      FROM (SELECT *
      FROM table) row_
      WHERE ROWNUM <= 100)
      WHERE rownum_ > 400

      which obviously wont return any rows except when first result < max results
      the fix might not be the best solution but at least it works. (Oracle8iDialect.cs)

      another thing i noticed while testing: setting only firstresult doesn't work (not fixed).

        Attachments

          Activity

            People

            • Assignee:
              flukefan Richard Brown
              Reporter:
              surgeon23 stanislav merovic
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?