Trying again with a simpler question. I have two classes that are each split
across to tables, and then have a relationship with each other. I have a
mapping like this:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="testjoins"
assembly="testjoins"
>
<class name="A" table="A" lazy="true">
<id name="Id" column="Id" unsaved-value="0">
<generator class="native"/>
</id>
<property name="Here" not-null="true" length="80"/>
<bag name="Bees">
<key column="Id"/>
<one-to-many class="B"/>
</bag>
<join table="APrime">
<key column="id"/>
<property name="Other"/>
</join>
</class>
<class name="B" table="B" lazy="true">
<id name="Id" column="Id" unsaved-value="0">
<generator class="native"/>
</id>
<property name="Here" not-null="true" length="80"/>
<join table="BPrime">
<key column="id"/>
<property name="Other"/>
</join>
</class>
</hibernate-mapping>
When I run this:
session
.CreateCriteria<A>()
.SetFetchMode("Bees", FetchMode.Join)
.List<A>();
I get this:
SELECT this_.Id as Id0_1_,
this_.Here as Here0_1_,
this_1_.Other as Other1_1_,
bees2_.Id as Id3_,
bees2_.Id as Id2_0_,
bees2_.Here as Here2_0_,
bees2_1_.Other as Other3_0_
FROM A this_
inner join APrime this_1_
on this_.Id = this_1_.id
left outer join B bees2_
on this_.Id = bees2_.Id
left outer join BPrime bees2_1_
on bees2_.Id = bees2_1_.id
whereas I expect something more like:
select [same stuff here]
from
(A a inner join APrime ap on a.Id=ap.Id)
left outer join
(B b inner join BPrime bp on b.Id=bp.Id) on A.Id = B.Id
Notice in my version that b is joined to bprime in a nested inner join,
whereas NH's behavior is to left outer join them.
Is there are a reason for this behavior? Should I fix it?
Thanks,
Isaac
--
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.