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

Excess DB parameters created when passing SqlFunctionProjection to LHS of InExpression

    Details

    • Sprint:

      Description

      Passing a "substring" function projection to the left side of an IN restriction causes duplicate parameters in the generated DB command, which in turn causes parameter type conversion exceptions in the DB.
      This issue has been described in more detail the following places. Unfortunately it doesn't appear to have been fixed in 3.2.0.GA despite some of these articles suggesting it was addressed in 3.0.0.GA.

      http://stackoverflow.com/questions/1729938/nhibernate-criteria-using-projections-for-substring-with-in-clause
      http://notesdotnet.wordpress.com/2010/01/10/substring-and-an-in-clause-with-nh-projections/
      http://blog-of-darius.blogspot.com/2011/02/nhibernate-criteria-using-substring.html

      I've attached a unit test that replicates the issue. It reliably shows too many ICriteriaQuery.CollectedParameters after calling InExpression.ToSqlString.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                nathan.baulch Nathan Baulch
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?