StoreProcedure in Hibernate with annotation
I am using Hibernate JPA implementation. Storeprocedure has two IN and One OUT parameter as bellow.
PROCEDURE procName(param1 VARCHAR2, param2 CHAR,result_cursor OUT dual_cursorType)
In Java code calling storeprocedure as bellow.
Pojo.java
public static Collection<xxx> findxxxxx( EntityManagerUtil emUtil, String param1, String param2) { Query query = emUtil.getEntityManager().createNativeQuery("{call packageName.procName(?,:param1,:param2)}"); //query.setParameter(0, ""); query.setParameter("param1", param1); query.setParameter("param2",param2);
return (Collection<xxx>)(query.getResultList()); } I am getting bellow exception : java.lang.IllegalArgumentException: org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [{call packageName.procName(?,:param1,:param2)}]
I am not able to find on forum how to register OUT paramter for storedprocedure.
|