Anybody???
On Mar 16, 2:56 pm, epitka <[email protected]> wrote:
> Ok I'll try to explain this little bit better. Basically I have two
> tables (Client), that has surrogate PK key "ClientID" and Client has
> natural key composed of ClientID and EffectiveDate.
> How do I map a collection in Client that has all items for ClientID.
>
> 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
-~----------~----~----~----~------~----~------~--~---