Well most of my tables do have database-generated keys. Although I can see the benefits of not using them (primarily the ability to do batch updates) I don't think any of my work-mates (my boss in particular) will be happy to change that at this stage :'(. I'll use 'insert' I think.
On 5 avr, 20:45, Davy Brion <[email protected]> wrote: > right, sorry about that :) > > 'insert' only retrieves the generated value after inserting, 'always' > retrieves the value every time an update to your object is flushed so in > most cases you'd probably want to use 'insert' > > though i would recommend not using any database-generated values at all > > On Tue, Mar 31, 2009 at 5:28 PM, graphicsxp <[email protected]>wrote: > > > > > right you are, otherwise my entity would not have the right value. > > Thanks for that. > > > However there is no such thing as generated=true, available values > > are 'never', 'insert', 'always'. I guess I should use insert ? > > > On 29 mar, 20:02, Davy Brion <[email protected]> wrote: > > > if you want the value of that column to be present in your entity after > > > persisting, map the property with generated="true" > > > > that does mean that NHibernate will have to do a select after the insert > > to > > > fetch the generated value though > > > > On Thu, Mar 19, 2009 at 6:41 PM, graphicsxp <[email protected] > > >wrote: > > > > > Thanks, that's it ! I'm still learning and I didn't know about this > > > > parameter. > > > > > On 19 mar, 16:35, Ayende Rahien <[email protected]> wrote: > > > > > insert=false in the mapping? > > > > > > On Thu, Mar 19, 2009 at 6:29 PM, graphicsxp < > > [email protected] > > > > >wrote: > > > > > > > Hi, > > > > > > > I have a column in my SQL Server table for which the default value > > is > > > > > > (getdate()). > > > > > > > When I try to persist my entity to this table I get an exception > > > > > > because that column does not allow null value. I haven't specified > > not- > > > > > > null=true in my mapping file, however the table column in sql > > server > > > > > > doesn't allow null. > > > > > > > But obviously nhibernate doesn't know about the default value, how > > can > > > > > > I tell it about this ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
