I am really stuck here, every time I am calling procedure hibernate is showing error
java.sql.SQLException: Cannot perform fetch on a PLSQL statement: next when calling stored procedure from hibernate
Can anyone help me out from this?
Procedure
CREATE OR REPLACE PROCEDURE TESTP(
pmaxrows IN NUMBER :=3 )
AS
in_clause VARCHAR2(256);
sel_query VARCHAR2(256);
n NUMBER := 0;
BEGIN
FOR x IN
(SELECT DISTINCT VENDOR_ID FROM MF_QUOTATIONS
)
LOOP
IF n <> 0 THEN
in_clause := in_clause || ', ';
END IF;
in_clause := in_clause || '''' || x.VENDOR_ID || '''';
n := 1;
END LOOP;
sel_query := 'select * from (select ITEM_ID, VENDOR_ID, TOTAL from
MF_QUOTATIONS) pivot (max(TOTAL) for VENDOR_ID in ('||in_clause||'));';
dbms_output.put_line (sel_query);
END TESTP;
Hibernate
Query q = session.getCurrentSession().getNamedQuery("callStockStoreProcedure")
.setParameter("pmaxrows", 3);
System.out.println("q="+q);
List result = q.list();
return result;
Entity class
@Entity
@Table(name="MF_QUOTATIONS")
@NamedNativeQueries({
@NamedNativeQuery(
name = "callStockStoreProcedure",
query = "CALL TESTP(:pmaxrows)",
resultClass = Quotations.class
)
})
public class Quotations {
..........
..........
}
Hibernate errors are below
java.sql.SQLException: Cannot perform fetch on a PLSQL statement: next