No, I'm not generating the database with NHibernate. Not completely sure that feature was available in version 1.2.
Thanks, Robert On Oct 26, 1:32 pm, Fabio Maulo <[email protected]> wrote: > <generator class="foreign"> > <param name="property">structural</param> > </generator> > > are you generating the DB using NH ? > > On Tue, Oct 26, 2010 at 3:17 PM, [email protected] < > > > > [email protected]> wrote: > > When trying to map a class and a composite with multiple sub-types to > > the same table, I get the error "Cannot insert explicit value for > > identity column in table 'Structural' when IDENTITY_INSERT is set to > > OFF." when attempting to create an instance of "Structural" that > > pertains to the mapping file below. I am using NHibernate 1.2 if it > > matters. I found the following article that suggest this type of > > mapping is possible: > >http://colinjack.blogspot.com/2008/03/nhibernate-working-around-lack-... > > > <?xml version="1.0" encoding="utf-8" ?> > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> > > <class name="Esl.Domain.Buildings.Structural, Esl.Domain" > > table="Structural"> > > <id name="id" access="field" column="Id"> > > <generator class="native" /> > > </id> > > <property name="isDirty" column="IsDirty" access="field"/> > > <property name="solarHeatGain" column="SolarHeatGain" > > access="field" type="Nullables.NHibernate.NullableDoubleType, > > Nullables.NHibernate" /> > > <property name="wallCavityInsulation" > > column="WallCavityInsulation" > > access="field" type="Nullables.NHibernate.NullableDoubleType, > > Nullables.NHibernate" /> > > <property name="wallContinuousInsulation" > > column="WallContinuousInsulation" access="field" > > type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" / > > > <property name="wallExteriorFinish" > > column="WallExteriorFinish" > > access="field" /> > > <property name="uValue" column="UValue" access="field" > > type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" / > > > <property name="numberOfBedrooms" column="NumberOfBedrooms" > > access="field" type="Nullables.NHibernate.NullableInt32Type, > > Nullables.NHibernate" /> > > <many-to-one name="roof" access="field" cascade="all" > > class="Esl.Domain.Buildings.Roof, Esl.Domain" column="RoofId" /> > > > <one-to-one name="foundation" access="field" cascade="all-delete- > > orphan" /> > > > <list access="field" name="floors" table="Floors" cascade="all- > > delete-orphan"> > > <key column="StructuralId" /> > > <index column="Position" /> > > <one-to-many class="Esl.Domain.Buildings.Floor, > > Esl.Domain"/> > > </list> > > </class> > > > <class name="Esl.Domain.Buildings.Foundation, Esl.Domain" > > table="Structural" discriminator-value="-1"> > > > <id name="id" access="field" column="Id"> > > <!--This lets us get away breaking out Foundation into a class > > mapping without > > creating another database table or a database migration--> > > <generator class="foreign"> > > <param name="property">structural</param> > > </generator> > > </id> > > <discriminator column="FoundationType" type="integer" /> > > > <property name="isDirty" column="FoundationIsDirty" access="field"/ > > > <property name="insulation" column="FloorOrSlabInsulation" > > access="field" type="Nullables.NHibernate.NullableDoubleType, > > Nullables.NHibernate" /> > > > <one-to-one constrained="true" name="structural" access="field"/> > > > <subclass name="Esl.Domain.Buildings.SlabFoundation, Esl.Domain" > > discriminator-value="0"/> > > <subclass name="Esl.Domain.Buildings.PilingFoundation, Esl.Domain" > > discriminator-value="1"/> > > <subclass name="Esl.Domain.Buildings.PierAndBeamFoundation, > > Esl.Domain" > > discriminator-value="2"/> > > <subclass name="Esl.Domain.Buildings.ConditionedBelowFoundation, > > Esl.Domain" > > discriminator-value="3"/> > > </class> > > </hibernate-mapping> > > > Any help would be greatly appreciated. > > > Thanks, > > > Robert > > > -- > > 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]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
