• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate; error executing stored procedure

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I an getting a perplexing error.

"org.hibernate.exception.GenericJDBCException: could not execute query
com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 3."

My stored procedure has two parameters, not three.

The signature of the stored proc is...
PROCEDURE [dbo].[SP_GEO_US_FIND_POSTAL_CODES]
@postalCode nvarchar(50),
@radius nvarchar(50)

--returns a list from a select

My hbm looks like this...

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<sql-query name="geoUsFindPostalCodesSP" callable="true">

<return class="persistance.ds.jdo.GeoCodes">
<return-property name="code" column="CODE"/>
</return>

{? = call SP_GEO_US_FIND_POSTAL_CODES(?, ?) }
</sql-query>
</hibernate-mapping>



My Java Call...

List<String> params = new LinkedList<String>();
params.add("60990");
params.add("5");

Query query = session.getNamedQuery(geoUsFindPostalCodesSP");
int i = 0;
Iterator<?> ix = params.iterator();
while (ix != null && ix.hasNext())
{
query.setParameter(i, ix.next());
i++;
}

List<GeoCodes> geoCodesList = (List<GeoCodes>) query.list();//error

 
reply
    Bookmark Topic Watch Topic
  • New Topic