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=..ETURN_VALUE" type="INTEGER" length="4"/>
<procedure-parameter name=..egionID" 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..ETURN_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
This archive was generated by hypermail 2.0.0 : Thu Apr 26 2007 - 12:43:08 EDT