Hi,
I’m using MyEclipse and JPA/Hibernate. I like the JPA pagination feature. However, I need to call stored procedures in my application. Specifically, I created a stored procedure:
CREATE OR REPLACE PROCEDURE MCRUZ.HIBERNATETESTINSERT (
valStr IN VARCHAR2,
valNum IN NUMBER,
valDate IN DATE,
valClob IN CLOB,
result OUT VARCHAR2
) AS
--
-- NAME :
-- DESCRIPTION :
-- AUTHOR :
BEGIN
insert into HIBERNATE_TEST values(valStr, valNum, valDate, valClob);
result := 'SUCCESS';
END;
which I try to call using createNativeQuery
...
final String queryString = " call hibernatetestinsert(?1, 5, null, null, ?2)";
Query query = getEntityManager().createNativeQuery(queryString);
String test = new String();
query.setParameter(1, "HelloParameter");
query.setParameter(2, test);
return query.getSingleResult();
...
I keep getting exceptions like
org.hibernate.HibernateException: Could not extract result set metadata
Does JPA/Hibernate work with stored procedures? If so, what can I use to execute the stored procedure? If not, should I go back to jdbc or use some other technology?
Thank you,
Marc Cruz
Marc