Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-1930

Filter condition on nullable many to one should be on the join, not the where

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0.GA
    • Fix Version/s: None
    • Component/s: Core
    • Labels:

      Description

      Using the code in NH-1919 Closed , get produces the following values for nullable property that has a filter on it:

      SELECT invoice0_.id          AS id1_1_, 
             invoice0_.otherprop   AS otherprop1_1_, 
             invoice0_.categoryid  AS categoryid1_1_, 
             category1_.id         AS id0_0_, 
             category1_.validuntil AS validuntil0_0_ 
      FROM   invoice invoice0_ 
             LEFT OUTER JOIN category category1_ 
               ON invoice0_.categoryid = category1_.id 
      WHERE  category1_.validuntil > @p0 
             AND invoice0_.id = @p1
      

      The problem is that the filter should be applied on the join, not on the where, since it filter the parent as well as the child.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ayenderahien Ayende Rahien
              • Votes:
                29 Vote for this issue
                Watchers:
                24 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Who's Looking?