Hi Sofia I suspect your scenario might be affected by the SCOPE_IDENTITY() bug as outlined in the link below:
http://connect.microsoft.com/SQLServer/feedback/details/328811/scope-identity-sometimes-returns-incorrect-value This bug is fixed in Sql Server 2012 but not in 2005 or 2008. The posting "Posted by *Microsoft* on 18/03/2008 at 13:10" has some workarounds for this issue which might help. Please let me know if this helps. Michael On Friday, 16 March 2012 23:03:59 UTC, Sofija Blazevski wrote: > > Hello, everyone! > > I'm new to NHibernate, and I would like to use it together with > FluentNHibernate. > I've been trying to use them together for an updatable view scenario. > > This is the problem: > > None of the following Id generator classes > <generator class="identity" /> > <generator class="native" /> > > allows inserting into updatable view. Updatable view (more precisely > database server) takes care of assigning id. > Each time I get "Null id" (or is it "Null identifier" ) thrown from > ISession.SaveOrUpdate method. > While, on the other hand, same scenario with inserting into table > works perfectly. > > On database everything is tested to work. > NHibernate version is 3.2.0.4000 > > What is correct way to setup NHibernate to allow inserting into a view > without providing value for whatever field is set as Id? > > I would like to use NHibernate for an application with intensive usage > of views and stored procedures. > Now, I know you probably don't like usage of updatable views, and I > would not like to get into discussion on why do I use them, I simply > need to use them - if I'm gonna use any ORM framework as there is no > painless way to just use stored procedures (I mean in any ORM in any > technology I came across so far). > > Thanks in advance for helping. > > - Sofija > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/mk-3sRgyEAEJ. 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.
