Skip to content

Commit b33095e

Browse files
committed
Fix
1 parent b845845 commit b33095e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/NHibernate/Loader/JoinWalker.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,15 @@ private void AddAssociationToJoinTree(IAssociationType type, string[] aliasedLhs
192192

193193
if (qc != null)
194194
{
195-
_joinQueue.Enqueue(new CollectionJoinQueueEntry(qc, subalias, path, pathAlias));
195+
var collection = new CollectionJoinQueueEntry(qc, subalias, path, pathAlias);
196+
// Many-to-Many element entity join needs to be added right after collection bridge table
197+
// (see IsManyToManyWith, ManyToManySelectFragment, IsManyToManyRoot usages)
198+
if (qc.IsManyToMany)
199+
{
200+
collection.Walk(this);
201+
return;
202+
}
203+
_joinQueue.Enqueue(collection);
196204
}
197205
else if (joinable is IOuterJoinLoadable jl)
198206
{

0 commit comments

Comments
 (0)