-->
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.  [ 1 post ] 
Author Message
 Post subject: JPA Stored Procedure issue
PostPosted: Mon Jan 26, 2015 5:49 pm 
Newbie

Joined: Wed May 11, 2011 7:40 pm
Posts: 4
I am using hibernate JPA to execute an stored procedure in spring application but it is resulting in below error. StoredPrcoedure does not have any parameters so below error is not intuitive. Any google search around this resulted in no results and references to spring/hibernate documentation also did not help. Any help around this would be greatly appreciated. I cannot seem to understand what I am doing wrong and totally stuck at this point..

Error:

org.hibernate.procedure.NoSuchParameterException: Could not locate parameter registered using that position [1]
at org.hibernate.procedure.internal.ProcedureCallImpl.getParameterRegistration(ProcedureCallImpl.java:338)
at org.hibernate.procedure.internal.ProcedureOutputsImpl.getOutputParameterValue(ProcedureOutputsImpl.java:68)
at org.hibernate.jpa.internal.StoredProcedureQueryImpl.getOutputParameterValue(StoredProcedureQueryImpl.java:276)

Entity class as below:

Code:

@Entity
@NamedStoredProcedureQuery(name = "getCountries", procedureName = "spLT_Countries", resultClasses = Country.class)
public class Country implements Serializable {

   private static final long serialVersionUID = 1L;

   @Id
   @Column(name = "countryid")
   private Long id;

   @Column(name = "ISOCountrycode")
   private String iso2;

   @Column(name="Country")
   private String name;
        :
        :
}



Stored procedure in MS SQL Server, existing one which I cannot modify.

Code:

ALTER procedure [dbo].[spLT_Countries]
as
begin
   SET NOCOUNT ON
   Set transaction isolation level read uncommitted
   Select countryid, ISOCountrycode, Country from RN_Country order by Country

end


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

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.