Reputation: 3805
Well, I have got a pl/sql function with next structure:
function Proc(SessionID SomeConst.TSessionID default null) return sys_refcursor is
rc sys_refcursor
I don't have any experience with pl/sql, but now I have to call this somehow. I know that this kind of procedure:
procedure LogOn(UserName in varchar2, Password in varchar2, SessionID out varchar2)
must be called like this:
CallableStatement callableStatement = sessionFactory
.getCurrentSession().connection()
.prepareCall("call PREQUEST.LOGON(?,?,?)");
callableStatement.setString(1, userName);
callableStatement.setString(2, password);
callableStatement.registerOutParameter(3, OracleTypes.VARCHAR);
callableStatement.execute();
return callableStatement.getString(3);
But Proc
has no out
parameter. What do?
UPD:
System.out.println(sessionFactory
.getCurrentSession()
.createSQLQuery(
"select Proc(:sessionId) from dual")
.setString("sessionId", sessionId).list().size());
I tried this, but console says:
org.hibernate.MappingException: No Dialect mapping for JDBC type: -10
Upvotes: 0
Views: 435
Reputation: 5868
Query query=session.createSQLQuery("select Proc('"+param+"') from dual");
List<MappedBean> result=query.list();
Since your function returns sys_refcursor
, get a bean say MappedBean
which would hold the data returned from function.
Upvotes: 1