Reputation: 2783
i have the following sql:
select a.a, b.b, c.c
from apple a
join burger b on a.b = b.b
left outer join charlie c on a.c = c.c
where c.x = 'kke';
to map it, i tried the following fluent nhibernate mapping:
public entityMap()
{
Table("apple");
Id(x => x.a, "a").GeneratedBy.TriggerIdentity();
Join("burger", m =>
{
m.Inverse();
m.Fetch.Join();
m.KeyColumn("b");
});
Join("charlie", m =>
{
m.Inverse();
m.Fetch.Join();
m.KeyColumn("c");
});
Where("this_1_.x = 'kke'");
}
which results in the following sql:
select a.a, b.b, c.c
from apple a
join burger b on a.a = b.b
left outer join charlie c on a.a = c.c
where c.x = 'kke';
as you can see, the joins are a.a = bb and a.a = c.c, when i want them to be a.c = c.c and a.b = b.b.
How can i acheieve this without References (i want only one entity from all three tables).
Upvotes: 1
Views: 683
Reputation: 52745
It's not possible.
I don't think NHibernate is the right tool for the kind of database-centric approach you are using.
Upvotes: 1