You might use named native queries to do this (annotations or xml mapping). If you are using hibernate as your persistence provider, set the hint "org.hibernate.callable" to true. To get out parameters you might use your entity mapping normally (property resultClass) or use scalar values normally as well.
Other provider than hibernate I don't how to implement surely.
Hope to had help.
If happen something bad in you life, don't ask God why it happened. Ask for what.
SCJP 5 (80%) - SCWCD 5 (91%) - SCBCD & SCJD coming soon...
Joined: Dec 14, 2009
Thanks Victor ,
But i am using JPA and how to get out parameter using named native / native query. If you have any sample example, it will be great help on me.
Joined: Aug 21, 2008
Sunil, suppose that you are using hibernate as you persistence provider and that we have the following SP:
Now you might define a named native query so that it remains callable by using a hint (in annotation):
I'm using annotations, and I have a stored procedure with 3 IN parameters and 2 OUT parameters. How can I execute and retrieve those 2 OUT parameters? I tried using this:
MY CALLING METHOD
This would actually execute my procedure, I can verify that from a little insert I'm doing with it, however the 2 output parameters do not show up . Is this the method q.getResultList().size(); to use to pick them up?
subject: How to call stored procedure from Entity Manager if there is out parameter in stored procedure.