Hi everyone,

I've found a problem similar to the one-to-one case where a simple many-to-one association leads to an inner instead of an outer join in some cases:

    public class First
    {
        public virtual int ID { get; set; }
        public virtual string Title { get; set; }
    }

    public class Second
    {
        public virtual int ID { get; set; }
        public virtual First First { get; set; }
    }

  <class name="First">
    <id name="ID">
      <generator class="native"/>
    </id>
    <property name="Title" />
  </class>

  <class name="Second">
    <id name="ID">
      <generator class="native"/>
    </id>
    <many-to-one name="First" fetch="join"/>
  </class>

  var items = session.CreateQuery("
        from Second s
        where s.First is null or s.First.Title is null")
  .List<Second>();

  select second0_.ID as ID4_, second0_.First as First4_
  from Second second0_, First first1_
  where
    second0_.First=first1_.ID
    and (second0_.First is null or first1_.Title is null)

From my understanding NHibernate should outer join to First, since Second.First can be null.

Please advise.

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

       FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to