openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Created: (OPENJPA-112) Native queries and named parameters: poor error message
Date Thu, 25 Jan 2007 01:39:49 GMT
Native queries and named parameters: poor error message

                 Key: OPENJPA-112
             Project: OpenJPA
          Issue Type: Bug
         Environment: windows xp, openjpa_097_incubating
            Reporter: Patrick Linskey

native queries fail when use named parameters

 int parm3 = 100;
String sql = "SELECT deptno,budget,NAME,MGR_EMPID,REPORTSTO_DEPTNO FROM DeptBean WHERE deptno
>= :deptno ";
Query getDept = _em.createNativeQuery(sql,DeptBean.class
List<DeptBean> rl = (getDept.getResultList());

<4|false|0.9.7-incubating-SNAPSHOT> org.apache.openjpa.persistence.ArgumentException:
The parameter name or position "deptno" passed to execute() is not valid.  All map keys must
be a declared parameter name or a number matching the parameter position. 
	at org.apache.openjpa.kernel.QueryImpl.toParameterArray(
	at org.apache.openjpa.kernel.QueryImpl.execute(
	at org.apache.openjpa.kernel.QueryImpl.execute(
	at org.apache.openjpa.kernel.DelegatingQuery.execute(
	at org.apache.openjpa.persistence.QueryImpl.execute(
	at org.apache.openjpa.persistence.QueryImpl.getResultList(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at junit.framework.TestCase.runTest(Unknown Source)
	at junit.framework.TestCase.runBare(Unknown Source)
	at junit.framework.TestResult$1.protect(Unknown Source)
	at junit.framework.TestResult.runProtected(Unknown Source)
	at Source)
	at Source)
	at junit.framework.TestSuite.runTest(Unknown Source)
	at Source)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message