wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate; error executing stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate; error executing stored procedure" Watch "Hibernate; error executing stored procedure" New topic
Author

Hibernate; error executing stored procedure

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate; error executing stored procedure
 
Similar Threads
Executing stored procedures in hibernate
Hibernate/Native SQL and null inparams
Urgent Help to call Stored Proc from Hibernate Mapping Exception.
Help needed for executing Sybase stored procedure using Hibernate
Problem with Sybase stored proc in hibernate