Hey Piotr,

     I also met this problem. Did you find out any solution? Thanks !

在 2009年2月23日星期一UTC+8下午3时22分07秒,Piotr Jakóbczyk写道:
>
> I would like to point that above mapping pattern works, but only when 
> the second mapping (of class BusinessObject) was added to NH 
> configuration BEFORE the first one mapping (of ConcreteObject1 and 
> ConcreteObject2). 
>
> On 20 Lut, 17:13, Piotr Jakóbczyk <[email protected]> wrote: 
> > I can't send actual classes and tables, but let's try simple example: 
> > 
> > abstract class BusinessObject 
> > { 
> > 
> > } 
> > 
> > class ConcreteObject1 : BusinessObject 
> > { 
> > 
> > } 
> > 
> > class ConcreteObject2 : BusinessObject 
> > { 
> > 
> > } 
> > 
> > Additionaly thera are many ohter classes inherited from 
> > ConcreteObject1 as well as ConcretObject2. Except of base class - 
> > BusinessObject - both of concrete class have different specific 
> > characters. 
> > For some reason objects of both concrete classes MUST be stored in 
> > distinct tables: TABLE1, TABLE2. 
> > 
> > Sa we have following mappings: 
> > 
> > <class name="ConcreteObject1" table="TABLE1" polymorphism="explicite" 
> > 
> >         <subclass> 
> >         </subclass> 
> >         <subclass> 
> >         </subclass> 
> > </class> 
> > 
> > <class name="ConcreteObject2" table="TABLE2" polymorphism="explicite" 
> > 
> >         <subclass> 
> >         </subclass> 
> >         <subclass> 
> >         </subclass> 
> > </class> 
> > 
> > Mapping strategy of subclasses is not importat at this moment. 
> > Important fact is that mapping strategy for subclasses of 
> > ConcreteObject1 can be different from mappng strategy for subclasses 
> > of ConcreteObject2. 
> > 
> > But in some cases we need to query about list of BusinessObject's 
> > (ConcreteObject1 and ConcreteObject2 together) base properties. So we 
> > introduced some special marker classes: 
> > 
> > class ConcreteObject1Marker : BusinessObject 
> > { 
> > 
> > } 
> > 
> > class ConcreteObject2Marker : BusinessObject 
> > { 
> > 
> > } 
> > 
> > There are no classes inherited from ConcreteObject1Marker or 
> > ConcreteObject2Marker. 
> > 
> > And we want to prepare following mapping of BusinessObject class: 
> > 
> > <class name="BusinessObject" abstract="true" mutable="false" 
> > polymorphism="explicite" > 
> >         <union-subclass name="ConcreteObject1Marker" table="TABLE1"> 
> >         </union-subclass> 
> >         <union-subclass name="ConcreteObject2Marker" table="TABLE2"> 
> >         </union-subclass> 
> > </class> 
> > 
> > And now we should can quering about BusinessObject's instances 
> > although they are stored in distinct tables (TABLE1 and TABLE2). 
> > 
> > -- 
> > Piotr Jakóbczyk 
>
> -- 
> Piotr Jakóbczyk

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to