Many many thanks Diego!! I think this is exactly what I was looking for :) I still need to play a bit with this, but I reckon that would do the trick.
thanks again, nieve On 3 April 2010 18:48, Diego Mijelshon <[email protected]> wrote: > Both solutions would work. > If you decide to merge them (you're considering, so it probably makes > sense), you can still have a "MemberType" property that implements a > strategy pattern to handle the behavior of a "regular" Member or a > "Delegate". > You can use > http://unhaddins.googlecode.com/svn/trunk/uNhAddIns/uNhAddIns/UserTypes/GenericWellKnownInstanceType.cs > to > map it to the db without further ado, or you can have a separate MemberType > entity that is mapped as table-per-class-hierarchy. > > Diego > > > > On Sat, Apr 3, 2010 at 13:18, Nieve . <[email protected]> wrote: > >> Thanks Diego, >> I thought so. Just out of curiosity, do you know what is the reason behind >> it? How can such a scenario be treated? Would having another >> subclass-subtable be the best way to go, or would eliminating the subclass >> and incorporating it in the parent class would be recommended? Do I miss >> something here? >> >> Thanks again, >> nieve >> >> >> On 3 April 2010 18:09, Diego Mijelshon <[email protected]> wrote: >> >>> You can only have <discriminator> in a class, not in a subclass. >>> >>> Diego >>> >>> >>> On Sat, Apr 3, 2010 at 12:41, Nieve . <[email protected]> wrote: >>> >>>> Thanks Fabio, >>>> >>>> I tried this, and it didn't work (am using NH 2.1 AFAIR): >>>> >>>> >>>> <?xml version="1.0" encoding="utf-8" ?> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> >>>> >>>> <class name="User" table="Users"> >>>> <id name="Id" type="Int32" column="Id"> >>>> <generator class="native"/> >>>> </id> >>>> <property name="Amount" column="Amount"/> >>>> >>>> <subclass name="Member" > >>>> <join table="Members"> >>>> <key column="Id" /> >>>> <discriminator column="Member_Type" type="string"/> >>>> <property name="Name" column="Name"/> >>>> <subclass name="Delegate" discriminator-value="DLGT"> >>>> <property name="SomeProperty" column="SomeProperty"/> >>>> </subclass> >>>> </join> >>>> </subclass> >>>> </class> >>>> </hibernate-mapping> >>>> >>>> What did I do wrong? >>>> >>>> Nieve >>>> >>>> >>>> On 3 April 2010 17:13, Fabio Maulo <[email protected]> wrote: >>>> >>>>> <subclass> >>>>> <join> >>>>> >>>>> http://nhforge.org/doc/nh/en/index.html#inheritance >>>>> >>>>> 2010/4/3 Nieve <[email protected]> >>>>> >>>>>> Hello all, >>>>>> I have a User parent class with 'child' classes like Member, >>>>>> Contributor, Trainer (and so on) which are all mapped with a table per >>>>>> subclass strategy, because all child tables/classes have not-null >>>>>> columns/properties... >>>>>> Now, the Member class has its own child class Delegate with only a >>>>>> couple of additional properties, which is why I would have loved >>>>>> having it mapped using a table per class, only AFAIK the two >>>>>> strategies mix only the other way around, so it can't be done. >>>>>> Anyone has an idea how can this be done? For the time being I put >>>>>> everything in my Member class/table, but I'm not too happy with this >>>>>> solution... >>>>>> >>>>>> -- >>>>>> 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. >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> 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]<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]<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]<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]<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]<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.
