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.
|