-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Add a Row to a child table with INSTEAD OF INSERT TRIGGER
PostPosted: Tue Aug 30, 2005 1:03 pm 
Newbie

Joined: Thu Aug 25, 2005 3:14 am
Posts: 19
Hi All!

I found a problem with a simple Parent-Child example.
I have 2 classes
Parent and Child as described in documentation.
Then i add INSTEAD OF INSERT TRIGGER on table Cilds
-------------------------------------------------------------
CREATE TRIGGER dbo.ti_io_Child
INSTEAD OF INSERT
AS
BEGIN
insert into Child(Code)
select Code+'_111'
from inserted

return
END
-------------------------------------------------------------
and after that I can't add new object in child collection and save it in Child table. From SQL Profiler i saw that TSQL Code that NHIbernate generate to save child object
exec sp_executesql N'INSERT INTO....;SELECT SCOPE_IDENTITY()'...
and when i run this query in QueryAnalyzer SELECT SCOPE_IDENTITY()' return NULL instead of Id of new added row, and therefore I catch exeption on client-side.

How workaround of this problem?? I can't remove trigger fron table - it very important for sequrity checking.
----
Thanks. And forgive me my terrible English.

_________________
------------------------------
NETDigitally yours Jericho


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.