An Analyst has nothing to do with a developer ;-) It is a specific
type of person in our company.
Person is a base class which regroups basic properties such as
FirstName, LastName, Address, etc, etc... I've simplified it greatly
in this post to keep it simple.
Then we have Employee and Analyst, which both inherits from Person but
they have completely different properties so it makes sense to
differentiate these two classes. An analyst cannot be an employee, so
they do express different type of things (they could be the dogs and
cats inheriting from animal ;-)
To get back to my problem, we have found a way but we are not sure it
is correct (although it works). In the person mapping we have added :
<!-- Description of a collection of analysts -->
<bag name="AnalystContractors" table="PersonAnalyst">
<key column="PersonID"/>
<many-to-many column="AnalystID" class="Metrica.Analyst, Metrica"/
>
</bag>
Now if we want to retrieve the collection, we need to get the person
entity and then we call the collection.
However ideally it should be a one-to-many relation, however it does
not accept a 'column' attribute. Can you explain that ?
Thanks !
On 16 juil, 14:20, Fabio Maulo <[email protected]> wrote:
> what happen if a Person can work as Analyst and as Developer ?or as Analyst
> and DBA ?
>
> What a person can do does not change the Type of the person...
> I mean an Animal can be a Cat or a Dog. A Dog can't be a Cat. A Dog can work
> as "watch dog" or as "shepherd dog" but even it can work as both.
>
> The inheritance express different type of thing and not different roles ;)
>
> 2009/7/16 graphicsxp <[email protected]>
>
>
>
>
>
> > Hi,
>
> > I can't figure out how to do my mapping.
>
> > I have 3 tables :
>
> > Person {PersonID, Name}
> > Analyst{AnalystID, PersonID, Role}
> > PersonAnalyst{PersonID, AnalystID}
>
> > In my business model an Analyst inherits from Person. And a Person can
> > holds a collection of Analysts.
>
> > I've managed to map Person and Analyst (using a joined-subclass for
> > Analyst) but I can't figure out how to map PersonAnalyst ! Can
> > someone help me with it ?
>
> > So far I've got that :
>
> > <?xml version="1.0" encoding="utf-8" ?>
>
> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > schema="TempCRM.dbo">
>
> > <class name="Metrica.Person, Metrica" table="Person">
>
> > <id name="Id" column="PersonID">
> > <generator class="identity"/>
> > </id>
>
> > <property name="Name" type="string" column="Name"/>
>
> > <!-- Description of an analyst entity -->
> > <joined-subclass name="Metrica.Analyst, Metrica" table="Analyst"
> > lazy="true">
> > <key column="PersonID"/>
> > <property name="Role" type="string" column="Role"/>
> > </joined-subclass>
> > </class>
> > </hibernate-mapping>
>
> --
> Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---