-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problem - Call Stored procedure by Hibernate
PostPosted: Fri Sep 10, 2010 2:25 pm 
Newbie

Joined: Fri Sep 10, 2010 1:43 pm
Posts: 1
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


Top
 Profile  
 
 Post subject: Re: Problem - Call Stored procedure by Hibernate
PostPosted: Tue Mar 29, 2011 11:17 pm 
Newbie

Joined: Thu Dec 16, 2010 5:04 pm
Posts: 4
I solve my similar problem delete the callable properties. My problem cause file is:

<sql-query name="AddLecturer" callable="true">
<return alias="lecturer" class="entities.dao.Lecturer"/>
<![CDATA[CALL AddLecturer(:pLecturerName)]]>
</sql-query>


And I delete the callable ="true" line and problem solved, I don't understand why? Maybe someone explain it, Good luck.

This was my solution.

<sql-query name="AddLecturer">
<return alias="lecturer" class="entities.dao.Lecturer"/>
<![CDATA[CALL AddLecturer(:pLecturerName)]]>
</sql-query>


Top
 Profile  
 
 Post subject: Re: Problem - Call Stored procedure by Hibernate
PostPosted: Thu Apr 26, 2012 12:20 am 
Newbie

Joined: Wed Apr 25, 2012 9:29 am
Posts: 2
Can you please share your SP details. Because I have same problem. I dontknow how to pass refcursor to stored procedure, if I use the code written by you, it is still telling that number of arguments are less than expected. Any body did solve this issue yet, or is it fixed by nHibernate 2.1.2 GA


Top
 Profile  
 
 Post subject: Re: Problem - Call Stored procedure by Hibernate
PostPosted: Thu Apr 26, 2012 12:55 am 
Newbie

Joined: Thu Apr 26, 2012 12:36 am
Posts: 4
hi all i have a same problem.

_________________
Michigan DUI


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.