Class structure looks like the following:

abstract ItemBase - Discriminator [Type] = 0 [PrimaryKey GuidComb] Id
... shared properties

Item : ItemBase - [Type] = 1
[HasAndBelongsToMany, Inverse = true, RelationType = Set] -> Documents
... other properties

ItemHistory : ItemBase - [Type] = 2
[HasAndBelongsToMany, Inverse = false, RelationType = Set] ->
Documents
... other properties

Document
[HasAndBelongsToMany, Inverse = false, RelationType = Set] -> Items
... other properties



The classes are in a Table-Per-Class-Heirarchy, with the following
tables:
Item [Id, Type, ...]
DocumentItem [Document, Item]
Document [Id, ...]



__The Problem__
If I create an association entry for ItemHistory.Documents, the
Document.Items collection loads it even though its not the mapped
type.

So the Document.Items collection could look like this: [Item,
ItemHistory, Item, Item, Item] which makes Item interface unusable for
collection items.

I have it 'working' now but had to add a Where clause in the mapping
that uses the NHibernate generated alias for the Item table: Where =
"item1_.Type = 1"

Is there a better way to make this work?

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.


Reply via email to