Gram, if you're Id's have business value (or some due) then i would suggest migrating the database away from user defined PK. keep the user-defined-id for cross referencing and other UI operations where the users are used to entering the user-defined-id.
NH may have a way to do this already with property-ref attributes in the mappings. If this works the way I think it does you can add PKs to the entities but have 1:n n:m and m:n map on the user-defined-id. once this migration is complete, you can migrate away from property-ref by alter the db schema. at this point the domain model wouldn't change, only the db schema/data. On Jan 12, 4:13 pm, Diego Mijelshon <[email protected]> wrote: > Also, TableHiLoGenerator DOES support a "where" parameter, which I believe > you would configure this way: > <generator class="hilo"> > <param name="where">table='this_class_table'</param> > </generator> > > Diego > > On Tue, Jan 12, 2010 at 18:09, Oskar Berggren <[email protected]>wrote: > > > You don't need multiple rows. You can use multiple hilo tables. > > > /Oskar > > > 2010/1/12 Graham Bunce <[email protected]>: > > > All, > > > > I know this isn't the "correct" way to do this but I need to know how > > > to use HiLo and have the hilo table store a row for each entity in my > > > system. > > > > My reason for this is that I am migrating an existing DB that uses 32- > > > bit integers with Identity over to NHibernate (currently 1.2 but we > > > aim to upgrade to 2.1.x as well). > > > > Therefore I cannot use 64-bit numbers, I need to pre-seed the HiLo > > > table and (annoyingly) some of the ID's have business meaning > > > (apparently they didn't originally, but over time, now they do). I > > > have ideas to sort that out but I'm stuck with the HiLo on 32-bit keys > > > whch means sooner or later I'm going to hit a maximum value problem. > > > We have a high volume database so I'd rather postpone that issue for > > > as long as I can, so I don't want to use the same HiLo across all my > > > entities unless there is a very good reason why I should.... > > > > I've read this thread > > >http://groups.google.com/group/nhusers/browse_thread/thread/7c70df65e... > > > > but nobody actually answered the question the poster asked, i.e. How > > > to you configure the mapping for a HiLo with a WHERE clause? > > > > I've tried google etc. and " NHibernate HiLo "Where parameter" " > > > returns 2 pages none of which actually provide a concrete example. > > > > Has anyone ever actually done this? Can you provide a mapping please? > > > > Thanks > > > > -- > > > 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. > > > -- > > 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.
-- 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.
