Hi again,

I had dropped the idea of using nHibernate, but I'm reconsidering.

So, I'm back with my initial problem, except I'm free to design the db
schema as I see fit.
But even with _no_ constraint watsoever, I can't seem to find a
correct way to map my classes to my DB.

The scenario is simple, and probably very common too (still the same
scenario as my initial post) :
We've got Clients. Clients can be businesses or customers.
So in terms of classes, we have Client, Contact and Company.
A Contact has a property Client (may be null because not all Contacts
are clients). Same for Company.
And a Client has two properties, Contact and Company, but only one of
them is non null.
We could model that with an abstract class Client, and two contrete
classes, BusinessClient that has a non null Company property and a
CustomerClient that has a non null Contact property.


The natural (for me) db schema doesn't work (cf earlier post).
So I'm trying to have my one-to-one mappings on the primary key, that
is if a Client is b2c, then the Client PK is the PK of the Contact,
and if a Client is b2b, the Client PK is the PK of the Customer.

But that doesn't really work either because nHibernate Id generator
"foreign" only accepts a single entity has a foreign key source.

And Creating a class hierarchy doesn't work eigher because the
generator must apparently be set at the root class.

So I welcome any advice, because I'm somewhat stumped: my domain model
is simple, yet I can't seem to find a good and simple way to map it to
a storage model.


Thanks

Blaise



On Jul 26, 2:49 pm, Fabio Maulo <[email protected]> wrote:
> aaahhh you never said you are using a Eliot Ness DB.
>
> I'll check what happen with your Eliot Ness.
>
>
>
>
>

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