• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call Oracle Procedure from java with Hibernate

 
Praveen Yendluri
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Can any one tell me how to call Oracle procedure with hibernate in java?

My Oracle package specification has the following procedure which is copying data from STAGE tables to target tables.

PROCEDURE PROC_CUSTOMER (pv_err_msg in out varchar2, pn_err_cd in out number);

My Java side Hibernate code is:

Session session = sessionFactory.getCurrentSession();
session.createSQLQuery(CALL PKG_IMPORT.PROC_CUSTOMER(:errMsg,:errCode)).setParameter("errMsg","'S'").setParameter("errCode",new Integer(0));

But respective procedure is not calling at all.

Can anyone tell me the way to call package in oracle.

Thanks,
Praveen
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are quite some limitations on using stored procedures with Hibernate. Have you seen the documentation?

Googling hibernate stored procedure example might also help.

In any case, you seem not to have posted your real code - the text of the query is not enclosed in quotes. But assuming this is the only omission in your code, I'd say the query doesn't get executed because you haven't invoked one of the methods to obtain the result (such as list()).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic