<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Calling Oracle Stored Procedure from Hibernate</title>
	<atom:link href="http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/</link>
	<description>Custom Software, Website and Mobile Development News</description>
	<lastBuildDate>Thu, 03 Nov 2011 12:44:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sandeep katakol</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-16309</link>
		<dc:creator>sandeep katakol</dc:creator>
		<pubDate>Mon, 24 Jan 2011 10:37:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-16309</guid>
		<description>My SP returns varaible number of columns depending on the paremeters passed...
How should I map the columns in .xml file</description>
		<content:encoded><![CDATA[<p>My SP returns varaible number of columns depending on the paremeters passed&#8230;<br />
How should I map the columns in .xml file</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Puru</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-13159</link>
		<dc:creator>Puru</dc:creator>
		<pubDate>Wed, 26 May 2010 02:58:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-13159</guid>
		<description>I am new to hibernate and java. 
I am doing a sample application to call the SP from Hibernate. I get the List but how do I see the values contained in the list. when I iterare the List ..it gives me the object but not the actual value.

Mapping:



	
	

 
 
   
   
 
  {  call SP_LIB_DTL(? , :branchCD ,:authorCD) }
 


============
Code to invoke the SP
	        Query q = session.getNamedQuery(&quot;LIB_SP&quot;);
	        q.setLong(&quot;branchCD&quot;, lib.getBranch_Code());
	        q.setLong(&quot;authorCD&quot;, lib.getAuth_Code());
	        //@SuppressWarnings(&quot;unchecked&quot;)
	        System.out.println(&quot;before getting the list&quot;);
	        List  list= q.list();
	        System.out.println(&quot;size of the list is &quot; + list.size());
	        for(int i=0; i&lt;list.size();i++){
	        	System.out.println(&quot;list get&quot;+list.get(i));
	        	}
	        System.out.println(&quot;after list&quot;);
==========================

results:
Hibernate: {  call SP_LIB_DTL(? , ? ,?) }
size of the list is 1
list getcom.fidelity.LibraryDetails@f0c85e
after list


Appreciate your help

Puru</description>
		<content:encoded><![CDATA[<p>I am new to hibernate and java.<br />
I am doing a sample application to call the SP from Hibernate. I get the List but how do I see the values contained in the list. when I iterare the List ..it gives me the object but not the actual value.</p>
<p>Mapping:</p>
<p>  {  call SP_LIB_DTL(? , :branchCD ,:authorCD) }</p>
<p>============<br />
Code to invoke the SP<br />
	        Query q = session.getNamedQuery(&#8220;LIB_SP&#8221;);<br />
	        q.setLong(&#8220;branchCD&#8221;, lib.getBranch_Code());<br />
	        q.setLong(&#8220;authorCD&#8221;, lib.getAuth_Code());<br />
	        //@SuppressWarnings(&#8220;unchecked&#8221;)<br />
	        System.out.println(&#8220;before getting the list&#8221;);<br />
	        List  list= q.list();<br />
	        System.out.println(&#8220;size of the list is &#8221; + list.size());<br />
	        for(int i=0; i&lt;list.size();i++){<br />
	        	System.out.println(&quot;list get&quot;+list.get(i));<br />
	        	}<br />
	        System.out.println(&quot;after list&quot;);<br />
==========================</p>
<p>results:<br />
Hibernate: {  call SP_LIB_DTL(? , ? ,?) }<br />
size of the list is 1<br />
list getcom.fidelity.LibraryDetails@f0c85e<br />
after list</p>
<p>Appreciate your help</p>
<p>Puru</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lila</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-12807</link>
		<dc:creator>Lila</dc:creator>
		<pubDate>Mon, 03 May 2010 13:59:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-12807</guid>
		<description>And how in that case to act?</description>
		<content:encoded><![CDATA[<p>And how in that case to act?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: subhasish sahu</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-12525</link>
		<dc:creator>subhasish sahu</dc:creator>
		<pubDate>Tue, 13 Apr 2010 17:22:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-12525</guid>
		<description>
         
              
         
            { ? = call CHECKUSERID1(?) }
     </description>
		<content:encoded><![CDATA[<p>{ ? = call CHECKUSERID1(?) }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: subhasish sahu</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-12524</link>
		<dc:creator>subhasish sahu</dc:creator>
		<pubDate>Tue, 13 Apr 2010 17:22:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-12524</guid>
		<description>sorry didnt mention the hbm file





  &lt;!--class name=&quot;component.Student&quot; table=&quot;STUDENT&quot;&gt;--&gt;
    
      
        SQE_TABLE_CONTACT
      
    
    
    
      
      
      
      
    
     
  
 
  
         
              
         
            { ? = call CHECKUSERID1(?) }
     
</description>
		<content:encoded><![CDATA[<p>sorry didnt mention the hbm file</p>
<p>  <!--class name="component.Student" table="STUDENT"&gt;--></p>
<p>        SQE_TABLE_CONTACT</p>
<p>            { ? = call CHECKUSERID1(?) }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: subhasish sahu</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-12523</link>
		<dc:creator>subhasish sahu</dc:creator>
		<pubDate>Tue, 13 Apr 2010 17:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-12523</guid>
		<description>im getting this error while executing store procedure through hibernate :

org.hibernate.HibernateException: Errors in named queries: CHECKUSERID1






  
 
  
         
              
         
            { ? = call CHECKUSERID1(?) }
     



-----------------------------------------------------------------



package component;


import org.hibernate.*;
import org.hibernate.cfg.*;
import java.util.List;

public class ProcedureCall
{
	public static void main(String args[])
	{
		Session session = null;
		SessionFactory factory = null;
		Transaction t = null;

		try
		{
			factory      = new Configuration().configure().buildSessionFactory();
			session      = factory.openSession();
			Query query  = session.getNamedQuery(&quot;CHECKUSERID1&quot;);
                        List results = query.list();
			session.close();
		}
		catch(Exception e)
		{
			System.out.println(e.toString());
		}
	}
}

-----------------------------------------------------------

CREATE OR REPLACE PROCEDURE CHECKUSERID1
(

 ref_cursor OUT SYS_REFCURSOR
)
AS
  IC_USER_TYPE varchar2(8);
BEGIN

OPEN ref_cursor FOR

SELECT IC_USER_TYPE into IC_USER_TYPE from USER_PROFILE
        where trim(IC_USER_ID)=&#039;SS1000&#039;;

END CHECKUSERID1;
/</description>
		<content:encoded><![CDATA[<p>im getting this error while executing store procedure through hibernate :</p>
<p>org.hibernate.HibernateException: Errors in named queries: CHECKUSERID1</p>
<p>            { ? = call CHECKUSERID1(?) }</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>package component;</p>
<p>import org.hibernate.*;<br />
import org.hibernate.cfg.*;<br />
import java.util.List;</p>
<p>public class ProcedureCall<br />
{<br />
	public static void main(String args[])<br />
	{<br />
		Session session = null;<br />
		SessionFactory factory = null;<br />
		Transaction t = null;</p>
<p>		try<br />
		{<br />
			factory      = new Configuration().configure().buildSessionFactory();<br />
			session      = factory.openSession();<br />
			Query query  = session.getNamedQuery(&#8220;CHECKUSERID1&#8243;);<br />
                        List results = query.list();<br />
			session.close();<br />
		}<br />
		catch(Exception e)<br />
		{<br />
			System.out.println(e.toString());<br />
		}<br />
	}<br />
}</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>CREATE OR REPLACE PROCEDURE CHECKUSERID1<br />
(</p>
<p> ref_cursor OUT SYS_REFCURSOR<br />
)<br />
AS<br />
  IC_USER_TYPE varchar2(8);<br />
BEGIN</p>
<p>OPEN ref_cursor FOR</p>
<p>SELECT IC_USER_TYPE into IC_USER_TYPE from USER_PROFILE<br />
        where trim(IC_USER_ID)=&#8217;SS1000&#8242;;</p>
<p>END CHECKUSERID1;<br />
/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ridwaan</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-12386</link>
		<dc:creator>Ridwaan</dc:creator>
		<pubDate>Mon, 29 Mar 2010 08:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-12386</guid>
		<description>Hi,

Thanks for the nice post.

I am trying to call a stored function from Hibernate.

The function:

create or replace
FUNCTION         FCT_CRYPTE_PWD(input_string IN VARCHAR2) RETURN VARCHAR2
IS
 hex_digest varchar2(32);
 digest varchar2(16);
BEGIN
 digest := DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT_STRING =&gt; input_string);
 SELECT Lower(RAWTOHEX(digest)) INTO hex_digest FROM dual;
 RETURN hex_digest;
END;

Is it possible to do so?
If Yes, How should the mapping and acces logic be?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for the nice post.</p>
<p>I am trying to call a stored function from Hibernate.</p>
<p>The function:</p>
<p>create or replace<br />
FUNCTION         FCT_CRYPTE_PWD(input_string IN VARCHAR2) RETURN VARCHAR2<br />
IS<br />
 hex_digest varchar2(32);<br />
 digest varchar2(16);<br />
BEGIN<br />
 digest := DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT_STRING =&gt; input_string);<br />
 SELECT Lower(RAWTOHEX(digest)) INTO hex_digest FROM dual;<br />
 RETURN hex_digest;<br />
END;</p>
<p>Is it possible to do so?<br />
If Yes, How should the mapping and acces logic be?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dhanya</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-10470</link>
		<dc:creator>Dhanya</dc:creator>
		<pubDate>Tue, 10 Nov 2009 19:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-10470</guid>
		<description>Pino,
Try to define a REF CURSOR and return the number of rows affected by the insert/update/delete operation
Hope this helps..</description>
		<content:encoded><![CDATA[<p>Pino,<br />
Try to define a REF CURSOR and return the number of rows affected by the insert/update/delete operation<br />
Hope this helps..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antony</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-10468</link>
		<dc:creator>Antony</dc:creator>
		<pubDate>Tue, 10 Nov 2009 19:12:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-10468</guid>
		<description>calling storeprocedure which returns nothing.

  
        
            
             
          
        { call P_TEST.SP_UPDATE_TEST_USER(:id,:displayName) }  
     
----------------------------------------------------------------------------------
procedure sp_update_test_user(intId in integer, vchDisplayName in varchar2)is
  begin
       update test_user tu set tu.display_name=vchDisplayName where tu.id=intId;
  end sp_update_test_user;
--------------------------------------------------------------------------------
    public boolean updateUserDB(){
        Transaction tx = null;
        Session session = HibernateUtil.getInstance().getCurrentSession();
        try {
            System.out.println(&quot;********** UpdateUserDB *************&quot;);
            System.out.println(&quot;id --&gt; &quot;+paramBean.getId());
            System.out.println(&quot;DisplayName --&gt; &quot;+paramBean.getDisplayName());
            System.out.println(&quot;*************************************&quot;);
            tx = session.beginTransaction();
            Query query = session.getNamedQuery(&quot;SP_UPDATE_TEST_USER&quot;);  
            query.setInteger(&quot;id&quot;, Integer.parseInt(&quot;&quot;+paramBean.getId()));
            query.setString(&quot;displayName&quot;, paramBean.getDisplayName());
            int retInt=query.executeUpdate();                
            tx.commit();           
            return true;
        } catch (RuntimeException e) {
            if (tx != null &amp;&amp; tx.isActive()) {
                try {
                    // Second try catch as the rollback could fail as well
                    tx.rollback();
                } catch (HibernateException e1) {
                    logger.debug(&quot;Error rolling back transaction&quot;);
                }
                // throw again the first exception
                throw e;
            }
            return false;
        }
    }
-----------------------------------------------------------------------------------

I hope this will help you.</description>
		<content:encoded><![CDATA[<p>calling storeprocedure which returns nothing.</p>
<p>        { call P_TEST.SP_UPDATE_TEST_USER(:id,:displayName) }  </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
procedure sp_update_test_user(intId in integer, vchDisplayName in varchar2)is<br />
  begin<br />
       update test_user tu set tu.display_name=vchDisplayName where tu.id=intId;<br />
  end sp_update_test_user;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
    public boolean updateUserDB(){<br />
        Transaction tx = null;<br />
        Session session = HibernateUtil.getInstance().getCurrentSession();<br />
        try {<br />
            System.out.println(&#8220;********** UpdateUserDB *************&#8221;);<br />
            System.out.println(&#8220;id &#8211;&gt; &#8220;+paramBean.getId());<br />
            System.out.println(&#8220;DisplayName &#8211;&gt; &#8220;+paramBean.getDisplayName());<br />
            System.out.println(&#8220;*************************************&#8221;);<br />
            tx = session.beginTransaction();<br />
            Query query = session.getNamedQuery(&#8220;SP_UPDATE_TEST_USER&#8221;);<br />
            query.setInteger(&#8220;id&#8221;, Integer.parseInt(&#8220;&#8221;+paramBean.getId()));<br />
            query.setString(&#8220;displayName&#8221;, paramBean.getDisplayName());<br />
            int retInt=query.executeUpdate();<br />
            tx.commit();<br />
            return true;<br />
        } catch (RuntimeException e) {<br />
            if (tx != null &amp;&amp; tx.isActive()) {<br />
                try {<br />
                    // Second try catch as the rollback could fail as well<br />
                    tx.rollback();<br />
                } catch (HibernateException e1) {<br />
                    logger.debug(&#8220;Error rolling back transaction&#8221;);<br />
                }<br />
                // throw again the first exception<br />
                throw e;<br />
            }<br />
            return false;<br />
        }<br />
    }<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>I hope this will help you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pino</title>
		<link>http://blog.unidev.com/index.php/2009/03/03/calling-oracle-stored-procedure-from-hibernate/comment-page-1/#comment-9742</link>
		<dc:creator>Pino</dc:creator>
		<pubDate>Fri, 23 Oct 2009 10:21:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.unidev.com/?p=75#comment-9742</guid>
		<description>And what about a stored procedure that returns nothing?  My stored proc has only input parameters.  How can i confiugure and call it?</description>
		<content:encoded><![CDATA[<p>And what about a stored procedure that returns nothing?  My stored proc has only input parameters.  How can i confiugure and call it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

