You want the <database-scope> mapping element; see http://ayende.com/blog/3947/nhibernate-mapping-database-object for an example of this in action.
Cheers, -Steve B. On Tuesday, May 29, 2012 11:35:43 AM UTC-4, nerdia wrote: > > Hi, > > I was wondering if anyone could help me figure out how to setup a > constraint from the hibernate XML. > > I need the combination of two columns to be unique. > > So for instance, if the columns are Name and Type, Then you could have > the following combinations in the DB: > > Name Type > John Leader > John Follower > Sam Leader > > I can add this to the DB directly with constraints: > ALTER TABLE [Members] ADD CONSTRAINT [UQ_NameType] UNIQUE > NONCLUSTERED > ( > [Name],[Type] ASC > )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY > = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [MAIN] > > But am not clear how to set it up in the XML. > > Any help would be appreciated. > > Thanks, > > Nadia -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/2qt_ESB2Vi4J. 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.
