• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem - Call Stored procedure by Hibernate

 
balakumar sg
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While i call the procedure by hibernate, i am getting the error like below

java.lang.IllegalArgumentException: callable not yet supported for native queries
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:147)


Code base and procedure

Oracle Procedure

CREATE OR REPLACE PROCEDURE PR_COMPANY_DETAILS2 (OUT_RESULT out SYS_REFCURSOR) as
BEGIN
open OUT_RESULT for
select C.COMPANY_NAME as COMPANY_NAME from COMPANY C where c.COMPANY_ID=1;
END;
/
exec PR_COMPANY_DETAILS2;


code

public void callProcedure(){
try{
Session session = SessionManager.currentSession();
Transaction tx = session.beginTransaction();
Query query = session.getNamedQuery("loadCompanyName");
int value = query.executeUpdate();
System.out.println(" OutPUT :"+value);
tx.commit();
}catch (Exception e) {
e.printStackTrace();
}
}

in .hbm.xml file

<sql-query name="loadCompanyName" callable="true">
<return class="com.template.pojos.CompanyDetailsBean">
<return-property name="companyName" column="COMPANY_NAME"/>
</return>
{ call PR_COMPANY_DETAILS2(?) }
</sql-query>



please help me to solve the issue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic