-->
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.  [ 2 posts ] 
Author Message
 Post subject: SQL Server procedure call
PostPosted: Wed Oct 26, 2011 4:12 am 
Newbie

Joined: Fri Oct 21, 2011 9:20 am
Posts: 3
Hi,

I'm having a problem calling a SQL Server stored procedure that returns value directly:

CREATE PROCEDURE TestProc
AS
BEIGN
RETURN 1
END

Doeas anyone jnow how to implement it as a named query in nhibernate??

something like:
<sql-query name="Test" callable="true">
<return-scalar column="Value" type="Int32" />
{ call TestProc}
</sql-query>

????????

it return error when i try to get a value from it:
Int32 ID = hqlSupport.Session
.GetNamedQuery("Test")
.List<Int32>()[0];
"Index out of bounds"

Please help...


Top
 Profile  
 
 Post subject: Re: SQL Server procedure call
PostPosted: Wed Oct 26, 2011 6:03 am 
Newbie

Joined: Fri Oct 21, 2011 9:20 am
Posts: 3
Solved:

<sql-query name="DefaultDeriveNewID" callable="true">
<return-scalar column="Value" type="Int32" />
<![CDATA[DECLARE @id int
EXECUTE @id = DeriveNewID :identifierID, :incCount
SELECT @id AS Value]]>
</sql-query>


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

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.