It sounds like what you really have is a multitenancy structure with
facility as your tenantid.  Using the composite feature in nhibernate isn't
going to work for you - it really is intended for true composite key
situations, not multitenancy, but there are some other avenues to consider.
 One is to use the filter feature of nhibernate:
http://ayende.com/blog/3993/nhibernate-filters and this is another
interesting way with views:
http://blogs.imeta.co.uk/jyoung/archive/2010/03/22/845.aspx It's too bad
you can't change the structure, table per tenant is much cleaner than
having a tenantid like this-tenantid ends up being more complex long term
(gotta remember those filters and where conditions)  with far more risk of
data leakage.

Good luck!
Anne

On Thu, Dec 15, 2011 at 4:32 AM, [email protected] <
[email protected]> wrote:

> I have the following scenario
>
> Table 1 -Admission
> Fields
>   FacilityId      - BigInt (Pk)
>   AdmissionId   BigInt (Pk)
>   PersonName - varchar(60)
>
> Table 2 - ResponsibleParty
> Fields
>   FacilityId - BigInt (Pk)
>   ResponsiblePartyId (Pk)
>   AdmissionId  (Fk)
>
> As you can see that all the tables have facilityId as part of their
> compound primary key and all the tables are partitioned on the basis
> of the facilityId. Hence the keys must be compound keys.
>
> Can someone tell me how to configure a compound key in NHibernate such
> that one of the keys is an assigned key whereas the other one is
> generated key using one of the generators.
>
> Please keep the following in mind:
> 1. The database design is fixed and cannot be changed. Call this a
> design constraint.
>
> I love NHibernate, but right now it's looking as if I might have to
> forgo using it in this particular project. Help would be greatly
> appreciated.
>
> Thanks
>
> --
> 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.
>
>

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