I have the following two tables:
Package
id
ClientPackage
id
clientNumber
packageId
The thing is that I do not have a Client table in this database (it resides in another database). Is there a way that I can create a Client mapping to a Client model which just consist of distinct “clientNumber” from the ClientPackage table while treating ClientPackage as a association table — meaning that I do not want a class or mapping for ClientPackage. I’m thinking that I could use a component and an idbag to accomplish this but I just wanted a more experienced opinion so that I know I’m doing the right thing.
From NH’s perspective, this is not a many-to-many relationship, precisely because Client is not mapped.
The mapping depends on how you want it represented in the domain model.
An idbag would work fine for mapping
Package.Clientsas anICollection<int>. You don’t need a component:And then you’ll use those ids to get the clients in the other database.