Well, you didn't mention that other bag. But again, you can't map to
something that isn't there.
So, filtering with Linq (the OfType extension method is probably what you
want) is probably the best option with that schema.

   Diego


On Fri, Jun 18, 2010 at 10:23, Jon Moore <[email protected]> wrote:

> Hi Diego,
> CustomField inherits from Field, Field has a many-to-one relationship with
> my EntityType Class. My EntityType class has a one-to-many relationship with
> Field (which I have mapped in a different bag), but I wanted to map a bag of
> only CustomFields as-well. I suppose I could just filter the Field list
> using linq to return only CustomFields....
>
> On Fri, Jun 18, 2010 at 1:03 PM, Diego Mijelshon 
> <[email protected]>wrote:
>
>> Your mapping is telling NH that in order to get the CustomFields
>> collection for your (unnamed class), it must filter
>> by bs_CustomField.EntityTypeId = (the PK of your unnamed class). Do you have
>> such a column?
>> Also, if you are declaring it as inverse, CustomField should have a
>> many-to-one relationship with your (unnamed class), using the same column.
>>
>>    Diego
>>
>>
>> On Fri, Jun 18, 2010 at 06:56, kmoo01 <[email protected]> wrote:
>>
>>> Guys,
>>> I have been struggling to get this working for a while now...
>>>
>>> I don't seem to be able to specifically map a bag (to an Ilist) of a
>>> subclass, I keep getting the error "Invalid column name
>>> 'EntityTypeID'", im sure its a something ive missed in the mapping as
>>> it doesnt look like nhibernate generating the sql to link the
>>> subclasses to the parent.
>>>
>>> for example if I try to create a bag of customfields (subclass of
>>> fields) from my EntityType class like this:
>>>
>>>  <bag name="CustomFields"  inverse="true">
>>>      <cache usage="read-write" />
>>>      <key column="EntityTypeID"  />
>>>      <one-to-many class="CustomField"/>
>>>    </bag>
>>>
>>> and my parent/subclass mapping looks like this:
>>>
>>> <class name="Field" table="bs_Field" abstract="true" >
>>>    <id name="Id" type="Int32" column="Id" unsaved-value="-1">
>>>      <generator class="native"/>
>>>    </id>
>>>    <property  ...
>>>    <many-to-one name="EntityType" class="EntityType"
>>> column="EntityTypeId" />
>>>    ....
>>>    <joined-subclass name="CustomField"
>>>                     extends="Field" table="bs_CustomField">
>>>            <key column="Id" />
>>>
>>>           <property .....
>>>
>>>   </joined-subclass>
>>>   <joined-subclass .....
>>> </class>
>>>
>>>
>>> any help would be greatly appreciated, I just cant see what I'm
>>> missing....
>>>
>>> --
>>> 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]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>>
>>  --
>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>  --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

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