cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Daniel Toffetti" <toffe...@loteria.gba.gov.ar>
Subject Error: Parameter #1 has not been set
Date Thu, 26 Apr 2007 16:39:15 GMT
Hi folks !

	I'm using Netbeans 5.5 and started a new visual web application just to try
the execution of stored procedures. I've used the Cayenne Modeler to extract
the information of an SQL Server 2000 database. After setting up the cayenne
library path and finding out where to put cayenne.xml and the datamap and
driver xml files, now I'm stuck with this error when trying to call a stored
procedure:

	java.sql.SQLException: Parameter #1 has not been set.

	The relevant portions of code are:

	In the datamap xml file:

	<procedure name="Region_Select" schema="dbo" catalog="Windnorth"
returningValue="true">
		<procedure-parameter name="@RETURN_VALUE" type="INTEGER" length="4"/>
		<procedure-parameter name="@RegionID" type="INTEGER" length="4"
direction="in"/>
	</procedure>

	And in the java code:

        try {
            DataContext context = DataContext.createDataContext();
            Procedure procedure =
context.getEntityResolver().lookupProcedure("Region_Select");
            ProcedureQuery q = new ProcedureQuery(procedure);
            q.addParameter("RegionID", 1);

            List rows = context.performQuery(q);

        } catch (Exception e) {
            e.printStackTrace();
        }


	I'm creating the ProcedureQuery using a procedure instead of a string as
suggested in the documentation, but I can't make it work. I've already tried
variations of this code such as adding a parameter for the @RETURN_VALUE,
which I don't think is needed, and adding the parameters to the procedure
instead of the porcedurequery.

	Any ideas ???

Thanks in advance !!

Daniel


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.1/776 - Release Date: 25/04/2007
12:19



Mime
View raw message