-->
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: How to return OUTPUT param from SP with Hibernate in MVC?
PostPosted: Thu Apr 28, 2016 9:48 am 
Newbie

Joined: Thu Apr 28, 2016 9:43 am
Posts: 1
We are using Hibernate in a project. We have a stored procedure with one Output Param. How to return it?

SP @TrainingIDOut int OUTPUT, @TrainingTypeID int, @TrainingName int

AS
BEGIN
SET NOCOUNT ON;

INSERT INTO [training].Training([TrainingTypeID],[TypeId] ,[Reference])
VALUES (@TrainingTypeID, @TrainingName)

SET @TrainingIDOut=@@IDENTITY

END

C# Hibernate:

public int AddNewTraining(Training NewTraining)
{
string query = "execute training.P_InsertTraining :TrainingTypeID, :TrainingName";
var result = Session.CreateSQLQuery(query)
.SetParameter("TrainingTypeID", NewTraining.TrainingType)
.SetParameter("TrainingName", NewTraining.TrainingType)
.List<int>();

//pseudo-code
?????
return OUTPUT-parameter
}


Thanks,

Stéphane.


Top
 Profile  
 
 Post subject: Re: How to return OUTPUT param from SP with Hibernate in MVC?
PostPosted: Thu Apr 28, 2016 10:08 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
That's NHibernate. I think you should use the NHibernate forum board.


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.