You will probably want to map that with Table-Per-Subclass. So you will use
the joined-sublcass syntax. You might want to consider combining the table
and using a discriminator instead considering the similarities.

This link will help explain more:
http://ayende.com/Blog/archive/2009/04/10/nhibernate-mapping-ndash-inheritance.aspx

- Robert

On Sun, Mar 28, 2010 at 11:18 PM, reggieboy <[email protected]>wrote:

> Hello guys i am currently thinking on how to map a database table like
> this
>
>
>    create table [User] (
>        Id UNIQUEIDENTIFIER not null,
>       RecordVersion INT not null,
>       Email NVARCHAR(255) null,
>       Password NVARCHAR(255) null,
>       UserCategory INT null,
>       primary key (Id)
>    )
>
>
>    create table Doctor (
>        Id UNIQUEIDENTIFIER not null,
>       RecordVersion INT not null,
>       Firstname NVARCHAR(255) null,
>       Lastname NVARCHAR(255) null,
>       Middlename NVARCHAR(255) null,
>       Gender INT null,
>       Birthdate DATETIME null,
>       primary key (Id)
>    )
>
>    create table Secretary (
>        Id UNIQUEIDENTIFIER not null,
>       RecordVersion INT not null,
>       Firstname NVARCHAR(255) null,
>       Lastname NVARCHAR(255) null,
>       Middlename NVARCHAR(255) null,
>       Gender INT null,
>       Birthdate DATETIME null,
>       primary key (Id)
>    )
>
>    alter table Doctor
>        add constraint FKCE4594AAF1922C4D
>        foreign key (Id)
>        references [User]
>
>    alter table Secretary
>        add constraint FKF4B0E86CF1922C4D
>        foreign key (Id)
>        references [User]
>
>
> what will the xml mapping file will look like?
>
> can i use polymorphic association with it?
> thanks guys in advance :)
>
> --
> 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]<nhusers%[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