AbhishekB
AbhishekB

Reputation: 2075

Expose stored procedure using oData service

I need to expose my stored procedure using oData. I have done it using EclipseLink JPA but without odata. Any link to the tutorial or an example will be appreciated.

Upvotes: 0

Views: 949

Answers (1)

Shiva
Shiva

Reputation: 6887

The best way to expose a stored procedure, will be to create a corresponding FunctionImport for it.

You can create a complex type, that corresponds to the return structure of your procedure, and map the input variables of the procedure to the FunctionImport input parameters.

Note: OData 4 defines something similar called ActionsImports too. The the only difference is, that ActionImports are "side effecting"

If you are using OData 4 and your procedure is changing some data you should use an ActionImport else, if its just reading the data and returning some results use FunctionImport.

If you are using OData 2 and you have a side effecting procedure, You should use a Function Import with IsSideEffecting flag set to true;

Links to implementation documents

Upvotes: 1

Related Questions