Hi Mike,

I prepared database side for the example we talked about, and I tested
scope_identity throughout stored procedures and instead of insert
trigger on a view.
Scope_identity works well within stored procedures but It seems it
doesn't work well within instead of triggers, and it doesn't work
after insert statement on a view .. probably due to instead of trigger
limitation. I'll check on 2012 as well.

I wouldn't want to bother you with this any more as at the end it
seems it is a database issue, it just wasn't clear from the start as
insert on a view is working fine.

Thank you for trying to help me!

Best,
Sofija

On Apr 7, 2:59 am, Michael Charalambous
<[email protected]> wrote:
> Hi Sofia
>
> Had a further look and the issue I referred to in the previous post causes
> incorrect IDs to returned not nulls, therefore I suspect it may be
> something else. So I have the following questions for you
>
> 1. Does the sql insert statement generated by NHibernate work when you try
> it against your db directly?
> 2. Does the statement try to update/insert fields from more than one table?
> Since as I understand this is not allowed in SQL Server.
>
> It would be really good if you could email a sample project to me with a
> failing test, as I have pretty much run out if ideas and this would really
> help me to identify the exact cause of your problem
>
> Mike
>
>
>
>
>
>
>
> On Friday, 6 April 2012 21:11:24 UTC+1, Sofija Blazevski wrote:
>
> > Hi Michael,
>
> > Thank you for the link, it is informative and helpful. I'll look more
> > into suggested workarounds.
>
> > Best,
> > Sofija
>
> > On Apr 5, 11:50 am, Michael Charalambous
> > <[email protected]> wrote:
> > > 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-...
>
> > > 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 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.

Reply via email to