[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - how to call oracle function with Hibernate JPA from JBoss se

jinkam do-not-reply at jboss.com
Mon Mar 24 02:26:49 EDT 2008


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138491#4138491

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138491




More information about the jboss-user mailing list