No, let me try that.
On Mar 17, 8:53 am, Oskar Berggren <[email protected]> wrote:
> Have you tried using a <map>? With <key column="ClientId"/> and <index
> column="EffDt"/>.
>
> /Oskar
>
> 2009/3/17 epitka <[email protected]>
>
>
>
> > I don't like them either, but I am stuck with legacy db. If it was me
> > I would not event map it in a class as it is purely for reporting and
> > does not belong in domain at all. But higher powers want it mapped as
> > history field. So I tried all possible ways to map this and cannot get
> > it done. I've googled for two days, nothing. If I had any hair left I
> > would pull it out.
>
> > On Mar 17, 8:40 am, Fabio Maulo <[email protected]> wrote:
> > > as you can see many people don't like composite POID.
>
> > > 2009/3/17 epitka <[email protected]>
>
> > > > 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?
>
> > > --
> > > Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---