I am calling a Stored Proc in Oracle using Hibernate.
Procedure:
create or replace
procedure GetStocks(email in VARCHAR2)
is
BEGIN
execute immediate 'SELECT * FROM stock WHERE email=email';
END;
Java Code
Query query = session.createSQLQuery("CALL GetStocks(:email)").addEntity(Stock.class).setParameter("email", "abc@xyz.com");
System.out.println("QUERY:"+query.toString());
System.out.println("QUERY SIZE:"+query.list().size());
List result = query.list();
for(int i=0; i<result.size(); i++){
Stock st = (Stock)result.get(i);
System.out.println("Address "+st.getdetails());
}
I have the following error:
Caused by: java.sql.SQLException: Cannot perform fetch on a PLSQL statement: next