1
votes

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).

1

1 Answers

1
votes

It's not possible.

I don't think NHibernate is the right tool for the kind of database-centric approach you are using.