I am sorry, maybe I missunderstood the answer, but is not clear yet to me if what I want to accomplish is possible. Can anyone help me?
Thanks! On Feb 24, 9:34 am, Dzyann <[email protected]> wrote: > Fabio, > Thanks for your answer. > I will explain what I am trying to accomplish, but due to copyright > reasons won't use the exact example :) > > We used to have a class "State" and there were 3 classes that would > inherit from State, I can't come up with good names, so i will just > call them "State1", "State2" and "State3". All this 4 classes were > mapped in the same table. > > Then there was the need to make State inherit from another class that > already exists in the system and adds certain functionality. This > class that lets call it "Extension" is already mapped and there are a > couple of other classes that inherit from it. > > The problem comes when i am trying to make State inherit from > Extension, because i would like to keep State mapped as used to be > (State, State1, State2 and State3 all in one table) and just inherit > from Extension that is mapped in its own table. Right now we are using > Fluent (a little old version of it), and i couldn't acomplish this > mapping with it. What it generates is: > > <code> > <?xml version="1.0" encoding="utf-8" ?> > - <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default- > lazy="true" assembly="Model" namespace="Model.States"> > - <joined-subclass name="State" table="States" xmlns="urn:nhibernate- > mapping-2.2" extends="Model.States.Extension, Model"> > <key column="Id" /> > <discriminator column="Type" type="String" force="true" /> > <subclass name="Model.States.State1, Model, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=bc872fcc54e69d1a" discriminator- > value="State1" /> > <subclass name="Model.States.State2, Model, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=bc872fcc54e69d1a" discriminator- > value="State2" /> > <subclass name="Model.States.State3, Model, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=bc872fcc54e69d1a" discriminator- > value="State3" /> > </joined-subclass> > </hibernate-mapping> > </code> > > Wich fails because it finds the tag "discriminator" inside a joined- > subclass. As with fluent wouldn't work i decide to try with the > mappings directly, but really haven't had luck, besides reading in the > documentation it seemed like what i wanted couldnt be done. I really > don't have much practice anymore with xml mappings and is probably > that the reason I am not accomplishing my objective. The truth is that > some weeks ago i had this same problem with other classes of the > system, and i tried mapping them with xml file but i couldn't, but > finally the problem got solved because we changed the model. > > I will appreciate any advice, Regards.- -- 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.
