That is not correct.
In any case, here's a simplified example I just tried.
Classes:
class Foo
Bar Bar
other properties...
class Bar
int Id
other properties...
var foosWithBar = session.CreateSQLQuery("select {Foo.*}, {Bar.*} from
Foo join Bar on Foo.Bar = Bar.Id")
.AddEntity("Foo", typeof(Foo))
.AddJoin("Bar", "Foo.Bar")
.List<Foo>();
That returns a list of Foo, with fully loaded Bar.
The alias parameter is required by AddJoin, that's a mistake in the docs.
Diego
On Fri, Aug 13, 2010 at 09:26, Corey Coogan <[email protected]> wrote:
> Thanks Diego, but if I add c.* to the select list I get an object[]
> returned with both items. The reference doc shows an AddJoin
> signature that requires only the path, not the alias.
>
>
> On Aug 12, 9:22 pm, Diego Mijelshon <[email protected]> wrote:
> > .AddJoin("c", "p.Client") means that the selected c.* columns contain al
> the
> > data for the Client. So, you need to add c.* to the select list.
> >
> > Diego
> >
> >
> >
> > On Thu, Aug 12, 2010 at 17:11, Corey Coogan <[email protected]> wrote:
> > > I have the SqlQuery below. I will to eager load the Register and
> > > Client entities. Unfortunately, I always get an
> > > IndexOutOfRangeException - Column Name doesn't exist in the Result
> > > Set.
> >
> > > The Policy, Register and Client entities each contain only a subset of
> > > the db tables. The Policy entity is loading fine so I expected the
> > > others would as well. Do I need to specify the columns for the joined
> > > entities explicitly in the Select?
> >
> > > @"
> > > select
> > > p.*
> > > from policy p
> > > inner join client c
> > > on c.client_number = p.client_number
> > > inner join register r
> > > on r.policy_number = p.policy_number
> > > and r.policy_date_time = p.policy_date_time
> > > where
> > > r.check_out is null
> > > and
> > > (
> > > (
> > > c.social_security1 = :{1}
> > > and upper(c.lname1) = :{2}
> > > and c.birthdate1 = :{3}
> > > )
> > > or
> > > (
> > > c.social_security2 = :{4}
> > > and upper(c.lname2) = :{5}
> > > and c.birthdate2 = :{6}
> > > )
> > > )
> > > and r.policy_date_time =
> > > (
> > > select max(r1.policy_date_time)
> > > from register r1, policy p1
> > > where r1.policy_date_time = p1.policy_date_time
> > > and r1.policy_number = p1.policy_number
> > > and r1.policy_number = p.policy_number
> > > and
> > > (
> > > (
> > > r1.status_1 in ('2','5','8') and
> > > nvl(p1.change_eff_date, p1.pol_eff_date) <= sysdate
> > > and p1.pol_exp_date >= sysdate
> > > )
> > > or
> > > (
> > > r1.status_1 = '2'
> > > and nvl(p1.change_eff_date, p1.pol_eff_date) >= sysdate
> > > AND r1.portfolio_set = 1
> > > )
> > > or
> > > (
> > > r1.status_1 in ('4','6','A')
> > > and p1.pol_term_date between add_months(sysdate,-13) and
> > > sysdate
> > > )
> > > )
> > > )
> > > ".FormatString( SSN1, LNAME1, BDATE1,
> > > SSN2, LNAME2, BDATE2
> > > ); ;
> >
> > > var query = Session.CreateSQLQuery(sql)
> > > .AddEntity("p",typeof(Policy))
> > > //TODO: why is this eager loading failing with: ERROR:
> > > Unable to find specified column in result set
> > > //.AddJoin("r","p.Register")
> > > //.AddJoin("c", "p.Client")
> > > ;
> >
> > > --
> > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
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.