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].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.