Is it possible to call oracle function other than procedure with Hibernate JPA? How?
I'm developing a web app with JBoss seam + Hibernate JPA, and I'd like to call an oracle function with JPA 's entityManager.createNativeQuery API。 But I failed.
The code has follows:
//===Java code with JPA
entityManager.createNativeQuery("{call get_filelist(?)}")
.setParameter(1, dirName)
.getSingleResult();
The oracle function is defined as follows:
//===Oracle function def
CREATE OR REPLACE FUNCTION get_filelist (p_path IN VARCHAR2)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'FileList.RunThis(java.lang.String) return String';
The error code is as follows:
PLS-00221: 'GET_FILELIST' is not a procedure or is undefined .
In fact, I can see the get_filelist with sqlplus when typing 'desc get_filelist'.
Thanks for your suggestion.
|