I have the following simplified mapping:

BaseEntity (abstract)

EntityA : BaseEntity

EntityB : BaseEntity

My inheritance strategy is table-per-subclass, using a discriminator
value.

EntityA needs to contain a collection of EntityB.

When I try to access the nested subclass (EntityB) collection, I get
an exception trying to query the collection. Looking at the SQL
generated, I see that the statement is attempting to fetch the ID
property of EntityA (the FK on the EntityB table) from the BaseEntity
table, instead of from the EntityB table.

Eg:

SELECT base.EntityA_ID, base.ID, eb.Name
FROM BaseEntity base
INNER JOIN EntityB eb ON base.ID = eb.ID
WHERE base.EntityA_ID = x

What I would expect to see is something like this:

SELECT base.ID, eb.Name
FROM BaseEntity base
INNER JOIN EntityB eb ON base.ID = eb.ID
WHERE eb.EntityA_ID = x

Any help would be greatly appreciated!

Regards
Don

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

Reply via email to