There are many many posts on this forum for people having issues with Calling Stored procedures form hibernate but unfortunately none of them have solutions.
I am trying to create a sql-query mapping in order to call a stored procedure as per the documentation found here,
http://www.hibernate.org/hib_docs/refer ... rysql.html. When implementing I get the very generic error message of "Errors in named Query".
My syntax seems appropriate given the example but have a few confirmations to make.
Is the return-alias the DTO that the result will map to? Can i assume the return-property tags are the variables in that DTO?
The call has two parameters, one for the resultset and one for the input parameter. Is it implied that the setParameter() on the java side is the parameter and the return-alias is the return?
Thanks you in advance for any help!!!!
Note: I have gotten around this in the meantime by calling the PROC in a createSQLQuery call and parsing out the result in the returned Object[]. While this works it is not optimal as the PROC itself could change it's signature underneath and the application would break without warning.
Hibernate version:
3.3
Mapping documents:
<sql-query name="fraudulentPanCheck_SP" callable="true">
<return alias="fraudulentPanCheck" class="com.abebooks.fraud.fraudulentpan.FraudulentPanCheckImpl">
<return-property name="status" column="STATUS"/>
<return-property name="fradulentPanId" column="FRAUDULENTPANID"/>
</return>
{ ? = call abedba.FRAUD_DETECTION_API.check_negative_pan(?) }
</sql-query>
Code between sessionFactory.openSession() and session.close():
fraudPanCheckResult = session.getNamedQuery("fraudulentPanCheck_SP")
.setParameter("p_ccnumber",goodPan)
.list();
Full stack trace of any exception that occurs:
org.hibernate.HibernateException: Errors in named queries: fraudulentPanCheck_SP
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
DEBUG