native=identity is the Dialect saying that the RDBMS supports identity 2009/10/29 Dan Normington <[email protected]>
> Kent, > I think all you have to do is change the generator class. You currently > have it set to "native". I personally haven't used Identity types in > NHibernate, but I think the following should work: > > <generator class="identity"/> > > ------------------------------ > *From:* Kent Boogaart <[email protected]> > > *To:* nhusers <[email protected]> > *Sent:* Thu, October 29, 2009 9:34:08 AM > *Subject:* [nhusers] Re: Update ID of entity after save > > > Thanks Dan, but what exactly are you suggesting I change? Nothing in > that link tells me what I should be doing to have my entity updated > automatically with its ID. > > I'm using SQL2005 if it makes any difference, which presumably it > shouldn't with NH. > > Thanks, > Kent > > > On Oct 29, 2:26 pm, Dan Normington <[email protected]> wrote: > > Check out this link. It seems to provide information on how to implement > this: > > > > http://nhforge.org/blogs/nhibernate/archive/2009/02/09/nh2-1-0-new-ge... > > > > ________________________________ > > From: Kent Boogaart <[email protected]> > > To: nhusers <[email protected]> > > Sent: Thu, October 29, 2009 9:21:00 AM > > Subject: [nhusers] Update ID of entity after save > > > > Hi, > > > > I feel like I must be missing something obvious. I'm using > > 2.1.0.GA<http://2.1.0.ga/>. > I > > have code that saves an entity with ID mapped as: > > > > <id name="Id" type="int" unsaved-value="0"> > > <generator class="native"/> > > </id> > > > > The entity is successfully saved, but its Id property remains as zero > > afterwards. > > > > How can I have NHibernate automatically update the Id property to the > > value of "SELECT SCOPE_IDENTITY"? > > > > I read somewhere about applying an IdAttribute to my entity's Id > > property, but that attribute no longer appears to exist. > > > > Thanks, > > Kent > > > > -- 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 -~----------~----~----~----~------~----~------~--~---
