I am working on new project which should be done using EJB 3.0 and persistence. I have to use stored procedures that are already written, and I am wondering is there a way to call stored procedure using persistence. I know how to call procedure without persistence. Any help is valuable.
Thanks in advance.
posted 9 years ago
JPA does not support stored procedure. However you can work around by converting your stored procedures to stored functions. However it is expected that some JPA providers will provide their extensions to use stored procedures. If I remember from the discussion in the EG, it will be addressed in JPA 2.0.
And call the stored functions in a Nattive Query e.g. you have a stored function name calculate with two in parameters and return floating type.
You call that select calcuate(x,y) from dual in native query