Can we call a STOREDPROC which inserts data into db which has no return value from NHIBERNATE? If so can any one please help me out with a small sample.
Asked
Active
Viewed 292 times
3 Answers
0
I don't know if it works if you define the query in XML, but you can simply create an ISQLQuery
and call ExecuteUpdate()
on it.

cremor
- 6,669
- 1
- 29
- 72
0
Use ADO.NET, -Get Connection object from NHibernate session, -Create a Dbcommand -Set your procedure in Dbcommand text -Run the command
Note: NHibernate might supprot stored procs but its a complicated process refer to this link, so opt ADO.NET which is optimum in your scenario.

sqlnewbie
- 857
- 3
- 16
- 39
0
This is one way:-
In your mappings file:-
<sql-query name="UpdateMeetingsSentFromTeamLeader">
<![CDATA[exec uspUpdateMeetingsSentFromTeamLeader :MeetingId]]>
</sql-query>
and your code is:-
public void UpdateMeetingsSentFromTeamLeader(int meetingId)
{
Session
.GetNamedQuery("UpdateMeetingsSentFromTeamLeader")
.SetInt32("MeetingId", meetingId)
.ExecuteUpdate();
}

Rippo
- 22,117
- 14
- 78
- 117