Use two joined subclasses in nhibernate -


OK, I'm working on a project which is already fully implementing it.

Scenerio: Two classes of subclasses (RoleA and RoleB) of a class (person).

What do I need to do that a given person can actually be in both RoleA and RoleB, how, when a person has already been created and given in the role, then I am with RoleA While maintaining relationships, can I make them in roles as well?

In this way, you have the following (with students and teachers who take the place of rolls and rollbacks) Is:

  & lt; Class name = "person" table = "person" & gt; & Lt; Id name = "id" column = "PersonID" & gt; & Lt; Generator class = "parent" /> & Lt; / Id & gt; & Lt; Property name = "name" column = "name" no-null = "true" /> & Lt; Included-sub-class name = "student" table = "student" & gt; & Lt; Major column = "PersonID" /> & Lt; Property Name = "Grade" column = "Grade" No-null = "true" /> & Lt; Joined in / subclass & gt; & Lt; Included-sub-class name = "teacher" table = "teacher" & gt; & Lt; Major column = "PersonID" /> & Lt; Property name = "classname" column = "classname" not-null = "true" /> & Lt; Joined in / subclass & gt; & Lt; / Square & gt; If this is the case, then your best bet is to use one-to-one mapping to complete the same thing. This is a good reference: 

This person had a similar problem like yours, and ended with one-to-one mapping option:


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -