Hi,
I am newbie. I have a function created in Oracle (like selectAllEmployments example in
http://www.hibernate.org/hib_docs/v3/re ... rysql.html).
Code:
CREATE OR REPLACE Function selectAllStocks()
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
BEGIN
OPEN st_cursor FOR
SELECT SYMBOL, CURRENT_PRICE, CHANGE, OPEN_PRICE
FROM STOCK_MASTER;
RETURN st_cursor;
END;
The named query mapping is like this:
Code:
<sql-query name="selectStocks" callable="true">
<return alias="stock" class="Stock">
<return-property name="symbol" column="SYMBOL"/>
<return-property name="currentPrice" column="CURRENT_PRICE"/>
<return-property name="change" column="CHANGE"/>
<return-property name="openPrice" column="OPEN_PRICE"/>
</return>
{ ? = call selectAllStocks() }
</sql-query>
When I call the named query, I get a SQLGrammarException.
Code:
return session.getNamedQuery("selectStocks").list();
I am able to execute the function within sqldeveloper and is simple.
Could anyone help me find the reason?
Thanks