Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NHibernate with output parameters

Does anyone know if NHibernate supports returning output parameters from stored procedures? I've had a search in the documentation but can't really find anything that confirms either way.

like image 206
lomaxx Avatar asked Nov 13 '08 00:11

lomaxx


2 Answers

I was facing the same problem. NHibernate does not let you use stored procedures in this manner. But it does allow a way to make calls using the plain old ADO.NET API. Here's an example -

http://refactoringaspnet.blogspot.com/2009/06/how-to-use-legacy-stored-procedures-in.html

like image 150
Rohit Agarwal Avatar answered Nov 15 '22 11:11

Rohit Agarwal


I can't officially confirm for you, but as far as I know, not directly. Stored procedure use in NHibernate is very specific to doing standard CRUD.

If you want to grab output paramaters (that are't the standard row count output parameter for INSERT, UPDATE, and DELETE), you could fall back to a different (or the standard) database access tools that give you direct access to SQL and the result set. (Assuming you can get by with bypassing NHibernate's cache. You'll want to make sure you flush NHibernate before you run the query too, etc.)

like image 42
Jon Adams Avatar answered Nov 15 '22 09:11

Jon Adams