views:

36

answers:

1

Hi,

I am working with legacy database with nhibernate (but assume the solution will be very similar as in hibernate) and we have nested composite keys, what I mean is following, our keys have this structure (this is pseudo c# syntax):

class PartnerKey
{
Public Int PartnerNr
}
Class TaxArtKey
{
Public String TaxArt
}
Class PartnerTaxArtKey
{
Public TaxArtKey TaxArt;
Public PartnerKey Partner;
}

by using composite-id i can do mpaping for first level of the keys but is it possible to it for other levels such us PartnerTaxArtKey.

thanks almir

A: 

You probably can try to use key-many-to-one mapping.

Sly
could you give me an example of that
zebra
You can have a look here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/example-mappings.html#example-mappings-typed-onetone
Sly
yes this is the right direction but, in my case class to which orderNumber maps is composed of two properties again, and this key nesting is recursive <composite-id name="id" class="Order$Id"> <key-property name="customerId" length="10"/> <key-property name="orderNumber"/> </composite-id>
zebra