Figured it out, was missing property-ref in key.
On Mar 16, 11:54 am, epitka <[email protected]> wrote:
> Hi, I am trying to map a collection (bag) or items that have composite
> id. The mapping I have throws an error saying that
>
> NHibernate.FKUnmatchingColumnsException: Foreign key
> (FK6A7D859A4C8DCC7F:ClientAcctType [ClientId, EffectiveDate])) must
> have same number of columns as the referenced primary key (Client
> [ClientId])
>
> I have a Client and ClientAcctType tables where ClientAcctType is
> basically a history table. So I want to map this history for specific
> Client. I created a ClientAccountTypeCompositeID class and mapped the
> history item like this
>
> ClientAcctountTypeHistoryItem:
> <composite-id class="ClientAccountTypeCompositeID"
> name="Id" access="lowercase-underscore">
> <key-property name="ClientID" access="property"
> column="ClientId"/>
> <key-property name="EffectiveDate" access="property"
> column="EffDt" />
> </composite-id>
>
> Client:
> <bag name="AccountTypeHistory" lazy="true">
> <key>
> <!-- a collection inherits the composite key type -->
> <column name="ClientId"/>
> <column name="EffectiveDate"/>
> </key>
> <one-to-many class="ClientAccountTypeHistoryItem"/>
> </bag>
>
> This should be pretty straight forward. Where I am going wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---