Hi,
I have added named sql in the hibernate mapping file as follows:
Code:
<sql-query name="getSum" callable="true">
<return-scalar column="sum" type="java.lang.Integer"/>
{?=call getSum(?,?)}
</sql-query>
and my dao code looks like(Using Spring+Hibernate):
Code:
Query query = getSession().getNamedQuery("getSum");
query.setParameter(1,"16");
query.setParameter(2,"10");
Integer sum = (Integer) query.uniqueResult();
However I get following exception:
Code:
java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at java.util.ArrayList.toArray(Unknown Source)
at org.hibernate.util.ArrayHelper.toTypeArray(ArrayHelper.java:75)
at org.hibernate.impl.AbstractQueryImpl.typeArray(AbstractQueryImpl.java:627)
at org.hibernate.impl.AbstractQueryImpl.getQueryParameters(AbstractQueryImpl.java:635)
at org.hibernate.impl.SQLQueryImpl.getQueryParameters(SQLQueryImpl.java:161)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:603)
Just wonder if anyone has called Oracle Function using Hibernate 3.0
Thanks.