Oh, why didn't you just say that :--) ~ Berryl
On Dec 25, 10:21 am, Fabio Maulo <[email protected]> wrote: > "*node <column> > attribute unique-key > > Two columns with same unique-key value will be part of the same unique > index. *" > > When I say "node <column>" it mean "node <column>". > When in the follow line I say "attribute unique-key" it mean "the attribute > unique-key of the node <column>". > > If you do another thing and you got an exception then, yes it is by design > (your design). > > > > > > > > > > On Sat, Dec 25, 2010 at 2:01 PM, Berryl Hesh <[email protected]> wrote: > > Sure, but I get a seemingly illogical error when I try to do this on > > the discriminator column: > > > ----> NHibernate.MappingException : > > Smack.ConstructionAdmin.Data.Mapping.Hbms.ActivitySubject.hbm.xml(13,70): > > XML validation error: The 'unique-key' attribute is not declared. > > ----> System.Xml.Schema.XmlSchemaValidationException : The 'unique- > > key' attribute is not declared. > > > line 13 is: > > > <discriminator column="ActivitySubjectType" type="System.String" > > unique-key="ActivitySubjectTypeBusinessId" /> > > <property name="BusinessId" length="25" not-null="true" unique- > > key="ActivitySubjectTypeBusinessId"/> > > > Is this by design? > > > On Dec 25, 7:50 am, Fabio Maulo <[email protected]> wrote: > > > node <column> > > > attribute unique-key > > > > Two columns with same unique-key value will be part of the same unique > > > index. > > > > On Sat, Dec 25, 2010 at 1:50 AM, Berryl Hesh <[email protected]> wrote: > > > > I wound up with the mapping below which kind of works but would work > > > > better if I could keep the combination of the natural-id and > > > > discriminator unique. Two questions: > > > > > 1) is this intentional or is there some way I am missing to map both > > > > columns as part of a unique key? > > > > > 2) The main reason I want to use inheritance here is so make it easy > > > > for an ActivitySubject to have the one to many relationship with > > > > Allocation. I am tempted to try an Any mapping instead (once I > > > > understand that better). If keeping discriminator from participating > > > > in a unique index with another column intentional, is there some > > > > obvious design flaw / obvious answer? > > > > > Cheers, > > > > Berryl > > > > > <class name="ActivitySubject" table="ActivitySubjects" discriminator- > > > > value="BASE_CLASS"> > > > > > <id name="Id" unsaved-value="0"> > > > > <column name="ActivitySubjectId" /> > > > > <generator class="hilo" /> > > > > </id> > > > > > <discriminator column="ActivitySubjectType" type="System.String" /> > > > > > <natural-id mutable="true"> > > > > <property name="BusinessId" length="25" not-null="true" /> > > > > </natural-id> > > > > > <property name="Description" length="75" not-null="true" /> > > > > > <set access="field.camelcase-underscore" cascade="all-delete-orphan" > > > > inverse="true" name="Allocations"> > > > > <key foreign-key="Allocations_Resource_FK"> > > > > <column name="ActivityId" /> > > > > </key> > > > > <one-to-many class="Allocation /> > > > > </set> > > > > > -- > > > > 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] > > > > > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup > > s.com>> > > > > . > > > > 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. > > -- > 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.
