Details

    • Sprint:

      Description

      Two similar unit test. First passed but second broken.

      Passed:
      Test
      public void OrdersWithSubquery1()

      { var query = (from order in db.Orders where order.OrderLines.Any() select order ).ToList(); Assert.AreEqual(830, query.Count); }

      And broken analog:
      Test
      public void OrdersWithSubquery2()

      { var query = (from order in db.Orders where ( from line in db.OrderLines select line.Order ).Contains(order) select order ).ToList(); Assert.AreEqual(830, query.Count); }

      Second is usefull when is no "order.OrderLines" collection.

      In second case NHibernate generates invalid join:

      select ...
      from Orders
      where exists (
      select Id
      from OrderLines
      where OrderLines.Id = Orders.OrderId
      )

      During building expression tree NHibernate just removes subquery "select" clause.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                unicrus Sergei Koshel
              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?