..on Oracle: java.lang.IllegalArgumentException: callable not yet supported for native queries
.hbm.xml:
Code:
<sql-query name="inventoryReport" callable="true">
{ call INVENTORY_REPORT() }
</sql-query>
Java:
Code:
session.getNamedQuery("inventoryReport").executeUpdate();
I searched on this and the most useful information is from like 2007. From this, there seems to be two solutions and i have concerns with each one.
First Solution: Replace the getNamedQuery() line with:
Code:
CallableStatement stmt = session.connection().prepareCall("{ call INVENTORY_REPORT() }");
stmt.execute();
My Issue: the connection() method is deprecated. And putting the actual SQL in the code kinda defeats the purpose of using Hibernate. This solution is not that far removed from being straight up JDBC code.
Second Solution: Get the latest version.
My Issue: I downloaded version 3.3.2.GA around a week or so ago, so i would imagine that i have at least a later version than this suggestions from '07.
For now, i'm using the first solution despite the deprecation. I'm just wondering if there is an update on how to call a stored proc. I really don't like hard coding calls in my Java code and using a deprecated method bothers me as well.
Thanks,
Miz