a few more words about NewSequentialID() vs. Guid.Comb : the former is being done in the SQL Server, so when you create a new entity in the application, NH has to go and INSERT it right away to get a value into the Id field, without waiting for session.Flush().
So, you lose much of the gain of using Guids for PK, as you can't really do things on a disconnected application. The Guid.Comb strategy on the other hand, is doing the same thing as NewSequentialID (that is - solving the problem of PK index rebuilds on inserts by ensuring a level of sequentiality on generated IDs), but it's doing that on the application side of things - so you are back into hitting the DB only when it's really needed. On Wed, Sep 10, 2008 at 12:04 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote: > In that scenario, you need to use "generated", IIRC. > The recommended value is guid.comb, btw. > > > On Mon, Sep 8, 2008 at 11:22 PM, Kaumil <[EMAIL PROTECTED]> wrote: > >> >> I am using NewSequentialID() function which is new in SQL Server 2005 >> as the default value for the column in database. This is the primary >> key column of my table. I set the generator class to native for this >> property/column in the mapping file for that table. >> >> I get an exception that - Value cannot be null. Parameter name: Id >> when I try to insert a record in that table. >> >> Can I use NewSequentialID() as the database default for a guid/ >> uniqueidentifier column? If I use the generator class to guid.comb, >> the insert does not throw an exception. >> >> Please advise. >> >> Thanks >> >> >> > > > > -- Ken Egozi. http://www.kenegozi.com/blog http://www.musicglue.com http://www.castleproject.org http://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
