Hello,
I have this Oracle function in the database:
Code:
type c_refcursor is ref cursor;
FUNCTION testHibernateFunction
RETURN c_refcursor
IS
ret_cur c_refcursor;
BEGIN
OPEN ret_cur FOR
SELECT * FROM category;
return ret_cur;
END testHibernateFunction;
I was wondering if there is anyway I can call this procedure without using @NamedNativeQuery. I tried this:
Code:
List<Category> categories = this.entityManager
.createNativeQuery("{? = call content_queries_pkg.testHibernateFunction}", Category.class)
.setHint("org.hibernate.callable", "true")
.setHint("org.hibernate.readOnly", "true")
.getResultList();
But I got this error:
Code:
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
Is @NamedNativeQuery the only way stored procedures can be used with hibernate?