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]> > . > 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.
