Skip to content

NH-3210 - NHibernate Linq Provider does cross join or left outer join and not inner join (even if outer-join=false on many-to-one mapping) #1128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nhibernate-bot opened this issue Oct 12, 2017 · 0 comments · Fixed by #2327

Comments

@nhibernate-bot
Copy link
Collaborator

nhibernate-bot commented Oct 12, 2017

Taavi Kõosaar created an issue — 10th July 2012, 13:41:08:

var st1 = from ultt in _nHibernateSession.Query<UnitLeadTimeTemplate>()
          where ultt.Unit.Id == unitId
          select ultt.LeadTimeTemplate;
st1.ToList();

var st2 = from ultt in _nHibernateSession.Query<UnitLeadTimeTemplate>()
          from ltt in _nHibernateSession.Query<LeadTimeTemplate>()
          where ultt.Unit.Id == unitId
          select ltt;
st2.ToList();

var st3 = from ultt in _nHibernateSession.Query<UnitLeadTimeTemplate>()
          join ltt in _nHibernateSession.Query<LeadTimeTemplate>() 
            on ultt.LeadTimeTemplate.Id equals ltt.Id
          where ultt.Unit.Id == unitId
          select ltt;
st3.ToList();
-- statement #1
select leadtimete1_.lead_time_template_id as lead1_24_,
       leadtimete1_.Name                  as Name24_,
       leadtimete1_.Description           as Descript3_24_
from   unit_lead_time_template unitleadti0_
       left outer join lead_time_template leadtimete1_
         on unitleadti0_.lead_time_template_id = leadtimete1_.lead_time_template_id
where  unitleadti0_.unit_id = 8378 /** @p0 **/

-- statement #2
select leadtimete1_.lead_time_template_id as lead1_24_,
       leadtimete1_.Name                  as Name24_,
       leadtimete1_.Description           as Descript3_24_
from   unit_lead_time_template unitleadti0_,
       lead_time_template leadtimete1_
where  unitleadti0_.unit_id = 8378 /** @p0 **/

-- statement #3
select leadtimete1_.lead_time_template_id as lead1_24_,
       leadtimete1_.Name                  as Name24_,
       leadtimete1_.Description           as Descript3_24_
from   unit_lead_time_template unitleadti0_,
       lead_time_template leadtimete1_
where  leadtimete1_.lead_time_template_id = unitleadti0_.lead_time_template_id
       and unitleadti0_.unit_id = 8378 /** @p0 **/

Even though in the mapping of UnitLeadTimeTemplate i have configured:
Many-To-One with not-null="true" and outer-join="false"

There doesnt seem to be any consistent way to force inner-join to happen with linq query implementation in NH.

maca88 added a commit to maca88/nhibernate-core that referenced this issue Mar 12, 2020
@hazzik hazzik added this to the 5.3 milestone Mar 21, 2020
maca88 added a commit to maca88/nhibernate-core that referenced this issue Mar 21, 2020
maca88 added a commit to maca88/nhibernate-core that referenced this issue Mar 24, 2020
georgi-yakimov pushed a commit to georgi-yakimov/nhibernate-core that referenced this issue Apr 16, 2020
maca88 added a commit to maca88/nhibernate-core that referenced this issue Apr 21, 2020
hazzik pushed a commit that referenced this issue May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment