It defaults to Auto. The recommended one really depends on what kind of app you are running and what you're putting on top of NH. A brief, non-scientific description of possible usages: - Always: can't think of any - Auto: desktop app with barebones NH (it's a "safe" setting). Works for Web apps too. - Never: only if you have a framework (like uNhAddIns conversations) that handles flushing and committing for you - Commit: MVC apps (OK, webforms too) using a session-per-request.
Anyway, you should read the description of the different settings and use whatever fits best within your workflow. Diego On Mon, Apr 12, 2010 at 08:48, BramW <[email protected]> wrote: > Thanks for your reply, I was using transaction, but It was indeed the > flushmode that did the trick. It probably defaults > to 'never'. So I change my configuration to use another mode. What > mode would you recommend? > > On Apr 12, 1:32 pm, Diego Mijelshon <[email protected]> wrote: > > You are not flushing your session and/or you're not using a transaction. > > > > This is the right way to persist an entity: > > using (var tx = session.BeginTransaction()) > > { > > session.Save(yourNewInstance); > > tx.Commit(); > > > > } > > > > I'm assuming session.FlushMode is set to anything but Never. In that > case, > > you'd have to call session.Flush() before the commit. > > > > Diego > > > > On Mon, Apr 12, 2010 at 06:49, BramW <[email protected]> wrote: > > > Are there any special prerequisites when switching from native Id > > > generation? > > > > > I'm trying to use HiLo or Guid.Comb as identity generators, but I seem > > > not to be able to store my model objects when using those generators. > > > When I switch back to native or identity I seem to get the objects > > > into the database. > > > > > NHibernate Profiler shows correct INSERT queries in the latter case > > > but none when using HiLo or Guid.Comb. My problem might be quite > > > trivial but I'm not able to see what I'm doing wrong > > > > > -- > > > 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]> > <nhusers%[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.
