-->
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.  [ 3 posts ] 
Author Message
 Post subject: Stored Procedure returning single row instead of different r
PostPosted: Mon Dec 05, 2011 5:14 am 
Newbie

Joined: Mon Dec 05, 2011 2:16 am
Posts: 3
Hi,
I am using JPA with Hibernate to call an Oracle Stored Procedure (SP).
The problem i am facing is that, instead of returning a set of different rows, the SP is returning the same row multiple times. The SP returns a ref-cursor and the out parameter is the first one in the SP call. The sp runs fine if i run it in sql developer i.e. it is giving me a set of different rows. Can anyone please help out?
Thanks in advance.

The hibernate hbm file contains the below mapping :-
Code:
<hibernate-mapping package="com.abc.domain.bo.helper">
   <class name="com.abc.domain.bo.helper.MyRequestList" > 
        <id name="myRequestId" > 
           <generator class="assigned" /> 
        </id>
        <property name="myRequestId" column="MY_REQUEST_ID" insert="false" update="false"/>
      <property name="submittedById" column="SUBMITTED_BY_ID" />
      <property name="submittedDate" column="SUBMITTED_DT" />
      <property name="processStatusCode" column="PROCESS_STATUS_CD" />
      <property name="latestIn" column="LATEST_IN" />
      <loader query-ref="myRequestList_query" />
     </class>
   
   <sql-query name="myRequestList_query" callable="true">
      <return alias="myRequestList" class="com.abc.domain.bo.helper.MyRequestList">
         <return-property name="myRequestId" column="MY_REQUEST_ID" />
         <return-property name="submittedById" column="SUBMITTED_BY_ID" />
         <return-property name="submittedDate" column="SUBMITTED_DT" />
         <return-property name="processStatusCode" column="PROCESS_STATUS_CD" />
         <return-property name="latestIn" column="LATEST_IN" />
      </return>
      { call spm_myresults_get(?, :reqId, :orderBy) }
   </sql-query>
</hibernate-mapping>


And, my Java code is shown below :-
Code:
                EntityManager em = getEntityManager(); 

           Query query = em.createNamedQuery("myRequestList_query");
           query.setParameter("reqId", clientId);
           query.setParameter("orderBy", orderByClause);

           List<MyRequestList> results = query.getResultList();


Regards,
Sid


Top
 Profile  
 
 Post subject: Re: Stored Procedure returning single row instead of different r
PostPosted: Wed Dec 07, 2011 3:23 am 
Newbie

Joined: Mon Dec 05, 2011 2:16 am
Posts: 3
Guys...Any updates please??


Top
 Profile  
 
 Post subject: Re: Stored Procedure returning single row instead of different r
PostPosted: Wed Dec 14, 2011 1:48 am 
Newbie

Joined: Mon Dec 05, 2011 2:16 am
Posts: 3
Guys,
i am yet to find a solution for this? Can anyone try this out ??


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.