If you want "jump" the mapping of IStatistic and the mapping of Satistic you can do it easy and you want full control over your explicit-mapping you can do something like... well... after the release of NH3.2Alpha3, if you are interested in an alternative way, send me you example and I will write a public post... again about the mix between explicit mapping but with the ability to choose which class/properties include/exclude from the mapping.
Thanks to help us. On Fri, Apr 29, 2011 at 5:20 AM, Michael DELVA <[email protected]>wrote: > After some more thinking, I realized that my I want is "just" a normal > inheritance mapping. > > So I used this mapping: > > mapper.Class<IStatistic>(cm => > { > ... > }); > > mapper.Subclass<MyStat>(cm => { }); > > mapper.Class<Action>(cm => > { > cm.Id(a => a.Id, idm => > { > idm.Access(Accessor.Field); > idm.Generator(Generators.Native); > }); > > cm.Property(a => a.Time); > > cm.ManyToOne(a => a.Statistic, pm => > { > pm.NotNullable(false); > pm.Column("StatisticId"); > }); > }); > > which gives me this mapping: > > <?xml version="1.0" encoding="utf-8"?> > <hibernate-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > namespace="Emidee.CommonEntities" assembly="Emidee.CommonEntities" > xmlns="urn:nhibernate-mapping-2.2"> > <class name="IStatistic" abstract="true"> > <id name="Id" access="property" column="IStatisticId" type="Int32"> > <generator class="native" /> > </id> > <discriminator /> > <property name="Name" access="readonly" not-null="true" /> > <property name="Attack" access="readonly" not-null="true" /> > <property name="Value" access="readonly" not-null="true" /> > </class> > <class name="Action"> > <id name="Id" access="field.camelcase" column="ActionId" type="Int32"> > <generator class="native" /> > </id> > <many-to-one name="Statistic" column="StatisticId" /> > <property name="Time" not-null="true" /> > </class> > <subclass name="Statistic" extends="IStatistic" /> > <subclass name="MyStat" extends="Statistic" /> > </hibernate-mapping> > > And now my test is working perfectly well. > > -- > 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. > -- 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.
