You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marie Goutière <sw...@hotmail.com> on 2006/03/27 18:16:05 UTC

ProcedureQuery problem

Hello
I've a problem pl/sql with a ProcedureQuery.
here's my java code :
ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
query.addParameter("idDevice", deviceId);
query.addParameter("codeMcoEnt", codeMco);
query.addParameter("dateQuestionBR", dateReview);
query.addParameter("codeForecast", forecastNum);

try{
List result =dgctContext.performQuery(query);
}
catch (Exception e){
// PB dans la requete return null
DgctLogger.error("DB Request GETEXIST2VALBR Failed");
DgctLogger.error(e.toString());
}

My proc stoc returns only one field of an oracle table

in my map.xml you can find :
<procedure name="GETEXAVALBR" returningValue="true">
<procedure-parameter name="valBr" type="VARCHAR" length="10" 
direction="out"/>
<procedure-parameter name="idDevice" type="VARCHAR" length="10" 
direction="in"/>
<procedure-parameter name="codeMcoEnt" type="VARCHAR" length="2" 
direction="in"/>
<procedure-parameter name="dateQuestionBR" type="VARCHAR" length="10" 
direction="in"/>
<procedure-parameter name="codeForecast" type="VARCHAR" length="10" 
direction="in"/>
</procedure>

and the declation of the procedure is :

CREATE OR REPLACE PROCEDURE GETEXAVALBR(
valBr OUT varchar,
idDevice IN varchar,
codeMcoEnt IN varchar,
dateQuestionBR IN varchar,
codeForecast IN varchar
) IS

here is the trace in tomcat :
QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind: '[OUT]', 'NA485', 
'2', '01/02/2004', '18']
I don't know if the binding is correct but I always have the same error 
although i'tried a lot of things.
here is the PL/SQL error
PLS-00306: wrong number or types of arguments in call to 'GETEXAVALBR'

I've no Idea left
Can anyone rescue me???? :))
Thanks



Re: OracleDataSourceFactory

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Cayenne end you need to specify JNDIDataSourceFactory and use the  
JNDI name mapped in Tomcat.

I don't have experience with OracleDataSourceFactory pool per se, but  
you don't have to use it - AFAIK Tomcat wraps the driver in its own  
pool.

Watch out for two things:

1. Oracle driver jar must be in $tomcat_home/common/lib

2. server.xml entry depends on Tomcat version. Here is examples of my  
existing configurations (note that there is no factory specification  
anywhere, just the driver)

*** Tomcat 5.5

<Context path="/myapp" docBase="myapp">
   <Resource name="jdbc/myds" auth="Container"
           type="javax.sql.DataSource"  
driverClassName="oracle.jdbc.driver.OracleDriver"
           url="jdbc:oracle:thin:@127.0.0.1:1521:dbname"
           username="userName" password="secret" maxActive="5"  
maxIdle="2"
	maxWait="-1"/>
</Context>

*** Tomcat 5.0

<Resource name="jdbc/myds" auth="Container"  
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myds">
     <parameter>
        <name>username</name>
         <value>***</value>
      </parameter>
      <parameter>
       <name>password</name>
       <value>****</value>
       </parameter>
      <parameter>
         <name>driverClassName</name>
         <value>oracle.jdbc.driver.OracleDriver</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:oracle:thin:@127.0.0.1:1521:dbname</value>
        </parameter>
<parameter>
     <name>maxActive</name>
     <value>20</value>
   </parameter>
   <parameter>
     <name>maxIdle</name>
     <value>10</value>
   </parameter>

</ResourceParams>

Andrus


On Apr 4, 2006, at 6:54 PM, Marie Goutière wrote:

> Hello everybody.
>
> Is it possible to make an OracleDataSourceFactory with Tomcat (in  
> the tomcat web.xml /ressourceParam tag) works with Cayenne or not.
>
> We're trying to open an other connection to an Oracle database but  
> it doesn't work.
> It seems that tomcat doesn't "take care" of this  
> OracleDataSourceFactory.
>
> Is anyone has ever tried this ?
>
> Thanks
> Marie
>
>
>


OracleDataSourceFactory

Posted by Marie Goutière <sw...@hotmail.com>.
Hello everybody.

Is it possible to make an OracleDataSourceFactory with Tomcat (in the tomcat 
web.xml /ressourceParam tag) works with Cayenne or not.

We're trying to open an other connection to an Oracle database but it 
doesn't work.
It seems that tomcat doesn't "take care" of this OracleDataSourceFactory.

Is anyone has ever tried this ?

Thanks
Marie



Re: ProcedureQuery problem

Posted by Marie Goutière <sw...@hotmail.com>.
Thanks
I'll try with a function to see if I still have the problem because for the 
moment we can't change Cayenne version.

Marie


>From: Andrus Adamchik <an...@objectstyle.org>
>Reply-To: cayenne-user@incubator.apache.org
>To: cayenne-user@incubator.apache.org
>Subject: Re: ProcedureQuery problem
>Date: Tue, 28 Mar 2006 13:00:12 +0400
>
>The problem is that certain versions of Oracle drivers do not provide  
>correct (per JDBC spec) "boolean execute()" implementation.
>
>Andrus
>
>
>On Mar 28, 2006, at 12:40 PM, Marie Goutière wrote:
>
>>We 're using the version 1.1.2 of Cayenne with Oracle 9i.
>>But I want to know what exactly is the problem.
>>Many Thanks
>>Marie
>>
>>
>>
>>>From: Andrus Adamchik <an...@objectstyle.org>
>>>Reply-To: cayenne-user@incubator.apache.org
>>>To: cayenne-user@incubator.apache.org
>>>Subject: Re: ProcedureQuery problem
>>>Date: Mon, 27 Mar 2006 21:33:49 +0400
>>>
>>>What version of Cayenne and Oracle do you have? It looks like you  are  
>>>hitting this issue:
>>>
>>>http://objectstyle.org/jira/browse/CAY-464
>>>
>>>It is fixed in 1.2M12 (but note that you have to use the auto-  adapter, 
>>>i.e. do not enter DataNode adapter name for the fix to work)
>>>
>>>Andrus
>>>
>>>
>>>On Mar 27, 2006, at 9:11 PM, Marie Goutière wrote:
>>>
>>>>
>>>>Thanks
>>>>you're it's quite ok but in Tomcat log there a little problem
>>>>QueryLogger: === updated 1 row. appears without stopping.
>>>>Is that normal???
>>>>My proc doesn't update anything :'(
>>>>I don't understand
>>>>
>>>>Thanks
>>>>Marie
>>>>
>>>>>From: Andrus Adamchik <an...@objectstyle.org>
>>>>>Reply-To: cayenne-user@incubator.apache.org
>>>>>To: cayenne-user@incubator.apache.org
>>>>>Subject: Re: ProcedureQuery problem
>>>>>Date: Mon, 27 Mar 2006 20:21:53 +0400
>>>>>
>>>>>Hi Marie,
>>>>>
>>>>>I noticed a mismatch between your procedure definition and   Cayenne  
>>>>>mapping:
>>>>>
>>>>><procedure name="GETEXAVALBR" returningValue="true">
>>>>>
>>>>>"returningValue" should only be "true" for Oracle *functions*,   not  
>>>>>procedures. Try unchecking the corresponding checkbox in  the  Modeler.
>>>>>
>>>>>Andrus
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:
>>>>>
>>>>>>Hello
>>>>>>I've a problem pl/sql with a ProcedureQuery.
>>>>>>here's my java code :
>>>>>>ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
>>>>>>query.addParameter("idDevice", deviceId);
>>>>>>query.addParameter("codeMcoEnt", codeMco);
>>>>>>query.addParameter("dateQuestionBR", dateReview);
>>>>>>query.addParameter("codeForecast", forecastNum);
>>>>>>
>>>>>>try{
>>>>>>List result =dgctContext.performQuery(query);
>>>>>>}
>>>>>>catch (Exception e){
>>>>>>// PB dans la requete return null
>>>>>>DgctLogger.error("DB Request GETEXIST2VALBR Failed");
>>>>>>DgctLogger.error(e.toString());
>>>>>>}
>>>>>>
>>>>>>My proc stoc returns only one field of an oracle table
>>>>>>
>>>>>>in my map.xml you can find :
>>>>>><procedure name="GETEXAVALBR" returningValue="true">
>>>>>><procedure-parameter name="valBr" type="VARCHAR" length="10"    
>>>>>>direction="out"/>
>>>>>><procedure-parameter name="idDevice" type="VARCHAR"  length="10"   
>>>>>>direction="in"/>
>>>>>><procedure-parameter name="codeMcoEnt" type="VARCHAR"  length="2"   
>>>>>>direction="in"/>
>>>>>><procedure-parameter name="dateQuestionBR" type="VARCHAR"    
>>>>>>length="10" direction="in"/>
>>>>>><procedure-parameter name="codeForecast" type="VARCHAR"   length="10"  
>>>>>>direction="in"/>
>>>>>></procedure>
>>>>>>
>>>>>>and the declation of the procedure is :
>>>>>>
>>>>>>CREATE OR REPLACE PROCEDURE GETEXAVALBR(
>>>>>>valBr OUT varchar,
>>>>>>idDevice IN varchar,
>>>>>>codeMcoEnt IN varchar,
>>>>>>dateQuestionBR IN varchar,
>>>>>>codeForecast IN varchar
>>>>>>) IS
>>>>>>
>>>>>>here is the trace in tomcat :
>>>>>>QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind:  '[OUT]',   
>>>>>>'NA485', '2', '01/02/2004', '18']
>>>>>>I don't know if the binding is correct but I always have the   same  
>>>>>>error although i'tried a lot of things.
>>>>>>here is the PL/SQL error
>>>>>>PLS-00306: wrong number or types of arguments in call to   
>>>>>>'GETEXAVALBR'
>>>>>>
>>>>>>I've no Idea left
>>>>>>Can anyone rescue me???? :))
>>>>>>Thanks
>



Re: ProcedureQuery problem

Posted by Andrus Adamchik <an...@objectstyle.org>.
The problem is that certain versions of Oracle drivers do not provide  
correct (per JDBC spec) "boolean execute()" implementation.

Andrus


On Mar 28, 2006, at 12:40 PM, Marie Goutière wrote:

> We 're using the version 1.1.2 of Cayenne with Oracle 9i.
> But I want to know what exactly is the problem.
> Many Thanks
> Marie
>
>
>
>> From: Andrus Adamchik <an...@objectstyle.org>
>> Reply-To: cayenne-user@incubator.apache.org
>> To: cayenne-user@incubator.apache.org
>> Subject: Re: ProcedureQuery problem
>> Date: Mon, 27 Mar 2006 21:33:49 +0400
>>
>> What version of Cayenne and Oracle do you have? It looks like you  
>> are  hitting this issue:
>>
>> http://objectstyle.org/jira/browse/CAY-464
>>
>> It is fixed in 1.2M12 (but note that you have to use the auto-  
>> adapter, i.e. do not enter DataNode adapter name for the fix to work)
>>
>> Andrus
>>
>>
>> On Mar 27, 2006, at 9:11 PM, Marie Goutière wrote:
>>
>>>
>>> Thanks
>>> you're it's quite ok but in Tomcat log there a little problem
>>> QueryLogger: === updated 1 row. appears without stopping.
>>> Is that normal???
>>> My proc doesn't update anything :'(
>>> I don't understand
>>>
>>> Thanks
>>> Marie
>>>
>>>> From: Andrus Adamchik <an...@objectstyle.org>
>>>> Reply-To: cayenne-user@incubator.apache.org
>>>> To: cayenne-user@incubator.apache.org
>>>> Subject: Re: ProcedureQuery problem
>>>> Date: Mon, 27 Mar 2006 20:21:53 +0400
>>>>
>>>> Hi Marie,
>>>>
>>>> I noticed a mismatch between your procedure definition and   
>>>> Cayenne  mapping:
>>>>
>>>> <procedure name="GETEXAVALBR" returningValue="true">
>>>>
>>>> "returningValue" should only be "true" for Oracle *functions*,   
>>>> not  procedures. Try unchecking the corresponding checkbox in  
>>>> the  Modeler.
>>>>
>>>> Andrus
>>>>
>>>>
>>>>
>>>>
>>>> On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:
>>>>
>>>>> Hello
>>>>> I've a problem pl/sql with a ProcedureQuery.
>>>>> here's my java code :
>>>>> ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
>>>>> query.addParameter("idDevice", deviceId);
>>>>> query.addParameter("codeMcoEnt", codeMco);
>>>>> query.addParameter("dateQuestionBR", dateReview);
>>>>> query.addParameter("codeForecast", forecastNum);
>>>>>
>>>>> try{
>>>>> List result =dgctContext.performQuery(query);
>>>>> }
>>>>> catch (Exception e){
>>>>> // PB dans la requete return null
>>>>> DgctLogger.error("DB Request GETEXIST2VALBR Failed");
>>>>> DgctLogger.error(e.toString());
>>>>> }
>>>>>
>>>>> My proc stoc returns only one field of an oracle table
>>>>>
>>>>> in my map.xml you can find :
>>>>> <procedure name="GETEXAVALBR" returningValue="true">
>>>>> <procedure-parameter name="valBr" type="VARCHAR" length="10"    
>>>>> direction="out"/>
>>>>> <procedure-parameter name="idDevice" type="VARCHAR"  
>>>>> length="10"   direction="in"/>
>>>>> <procedure-parameter name="codeMcoEnt" type="VARCHAR"  
>>>>> length="2"   direction="in"/>
>>>>> <procedure-parameter name="dateQuestionBR" type="VARCHAR"    
>>>>> length="10" direction="in"/>
>>>>> <procedure-parameter name="codeForecast" type="VARCHAR"   
>>>>> length="10"  direction="in"/>
>>>>> </procedure>
>>>>>
>>>>> and the declation of the procedure is :
>>>>>
>>>>> CREATE OR REPLACE PROCEDURE GETEXAVALBR(
>>>>> valBr OUT varchar,
>>>>> idDevice IN varchar,
>>>>> codeMcoEnt IN varchar,
>>>>> dateQuestionBR IN varchar,
>>>>> codeForecast IN varchar
>>>>> ) IS
>>>>>
>>>>> here is the trace in tomcat :
>>>>> QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind:  
>>>>> '[OUT]',   'NA485', '2', '01/02/2004', '18']
>>>>> I don't know if the binding is correct but I always have the   
>>>>> same  error although i'tried a lot of things.
>>>>> here is the PL/SQL error
>>>>> PLS-00306: wrong number or types of arguments in call to   
>>>>> 'GETEXAVALBR'
>>>>>
>>>>> I've no Idea left
>>>>> Can anyone rescue me???? :))
>>>>> Thanks


Re: ProcedureQuery problem

Posted by Marie Goutière <sw...@hotmail.com>.
We 're using the version 1.1.2 of Cayenne with Oracle 9i.
But I want to know what exactly is the problem.
Many Thanks
Marie



>From: Andrus Adamchik <an...@objectstyle.org>
>Reply-To: cayenne-user@incubator.apache.org
>To: cayenne-user@incubator.apache.org
>Subject: Re: ProcedureQuery problem
>Date: Mon, 27 Mar 2006 21:33:49 +0400
>
>What version of Cayenne and Oracle do you have? It looks like you are  
>hitting this issue:
>
>http://objectstyle.org/jira/browse/CAY-464
>
>It is fixed in 1.2M12 (but note that you have to use the auto- adapter, 
>i.e. do not enter DataNode adapter name for the fix to work)
>
>Andrus
>
>
>On Mar 27, 2006, at 9:11 PM, Marie Goutière wrote:
>
>>
>>Thanks
>>you're it's quite ok but in Tomcat log there a little problem
>>QueryLogger: === updated 1 row. appears without stopping.
>>Is that normal???
>>My proc doesn't update anything :'(
>>I don't understand
>>
>>Thanks
>>Marie
>>
>>>From: Andrus Adamchik <an...@objectstyle.org>
>>>Reply-To: cayenne-user@incubator.apache.org
>>>To: cayenne-user@incubator.apache.org
>>>Subject: Re: ProcedureQuery problem
>>>Date: Mon, 27 Mar 2006 20:21:53 +0400
>>>
>>>Hi Marie,
>>>
>>>I noticed a mismatch between your procedure definition and  Cayenne  
>>>mapping:
>>>
>>><procedure name="GETEXAVALBR" returningValue="true">
>>>
>>>"returningValue" should only be "true" for Oracle *functions*,  not  
>>>procedures. Try unchecking the corresponding checkbox in the  Modeler.
>>>
>>>Andrus
>>>
>>>
>>>
>>>
>>>On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:
>>>
>>>>Hello
>>>>I've a problem pl/sql with a ProcedureQuery.
>>>>here's my java code :
>>>>ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
>>>>query.addParameter("idDevice", deviceId);
>>>>query.addParameter("codeMcoEnt", codeMco);
>>>>query.addParameter("dateQuestionBR", dateReview);
>>>>query.addParameter("codeForecast", forecastNum);
>>>>
>>>>try{
>>>>List result =dgctContext.performQuery(query);
>>>>}
>>>>catch (Exception e){
>>>>// PB dans la requete return null
>>>>DgctLogger.error("DB Request GETEXIST2VALBR Failed");
>>>>DgctLogger.error(e.toString());
>>>>}
>>>>
>>>>My proc stoc returns only one field of an oracle table
>>>>
>>>>in my map.xml you can find :
>>>><procedure name="GETEXAVALBR" returningValue="true">
>>>><procedure-parameter name="valBr" type="VARCHAR" length="10"   
>>>>direction="out"/>
>>>><procedure-parameter name="idDevice" type="VARCHAR" length="10"   
>>>>direction="in"/>
>>>><procedure-parameter name="codeMcoEnt" type="VARCHAR" length="2"   
>>>>direction="in"/>
>>>><procedure-parameter name="dateQuestionBR" type="VARCHAR"   length="10" 
>>>>direction="in"/>
>>>><procedure-parameter name="codeForecast" type="VARCHAR"  length="10"  
>>>>direction="in"/>
>>>></procedure>
>>>>
>>>>and the declation of the procedure is :
>>>>
>>>>CREATE OR REPLACE PROCEDURE GETEXAVALBR(
>>>>valBr OUT varchar,
>>>>idDevice IN varchar,
>>>>codeMcoEnt IN varchar,
>>>>dateQuestionBR IN varchar,
>>>>codeForecast IN varchar
>>>>) IS
>>>>
>>>>here is the trace in tomcat :
>>>>QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind: '[OUT]',   
>>>>'NA485', '2', '01/02/2004', '18']
>>>>I don't know if the binding is correct but I always have the  same  
>>>>error although i'tried a lot of things.
>>>>here is the PL/SQL error
>>>>PLS-00306: wrong number or types of arguments in call to  'GETEXAVALBR'
>>>>
>>>>I've no Idea left
>>>>Can anyone rescue me???? :))
>>>>Thanks
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>



Re: ProcedureQuery problem

Posted by Andrus Adamchik <an...@objectstyle.org>.
What version of Cayenne and Oracle do you have? It looks like you are  
hitting this issue:

http://objectstyle.org/jira/browse/CAY-464

It is fixed in 1.2M12 (but note that you have to use the auto- 
adapter, i.e. do not enter DataNode adapter name for the fix to work)

Andrus


On Mar 27, 2006, at 9:11 PM, Marie Goutière wrote:

>
> Thanks
> you're it's quite ok but in Tomcat log there a little problem
> QueryLogger: === updated 1 row. appears without stopping.
> Is that normal???
> My proc doesn't update anything :'(
> I don't understand
>
> Thanks
> Marie
>
>> From: Andrus Adamchik <an...@objectstyle.org>
>> Reply-To: cayenne-user@incubator.apache.org
>> To: cayenne-user@incubator.apache.org
>> Subject: Re: ProcedureQuery problem
>> Date: Mon, 27 Mar 2006 20:21:53 +0400
>>
>> Hi Marie,
>>
>> I noticed a mismatch between your procedure definition and  
>> Cayenne  mapping:
>>
>> <procedure name="GETEXAVALBR" returningValue="true">
>>
>> "returningValue" should only be "true" for Oracle *functions*,  
>> not  procedures. Try unchecking the corresponding checkbox in the  
>> Modeler.
>>
>> Andrus
>>
>>
>>
>>
>> On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:
>>
>>> Hello
>>> I've a problem pl/sql with a ProcedureQuery.
>>> here's my java code :
>>> ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
>>> query.addParameter("idDevice", deviceId);
>>> query.addParameter("codeMcoEnt", codeMco);
>>> query.addParameter("dateQuestionBR", dateReview);
>>> query.addParameter("codeForecast", forecastNum);
>>>
>>> try{
>>> List result =dgctContext.performQuery(query);
>>> }
>>> catch (Exception e){
>>> // PB dans la requete return null
>>> DgctLogger.error("DB Request GETEXIST2VALBR Failed");
>>> DgctLogger.error(e.toString());
>>> }
>>>
>>> My proc stoc returns only one field of an oracle table
>>>
>>> in my map.xml you can find :
>>> <procedure name="GETEXAVALBR" returningValue="true">
>>> <procedure-parameter name="valBr" type="VARCHAR" length="10"   
>>> direction="out"/>
>>> <procedure-parameter name="idDevice" type="VARCHAR" length="10"   
>>> direction="in"/>
>>> <procedure-parameter name="codeMcoEnt" type="VARCHAR" length="2"   
>>> direction="in"/>
>>> <procedure-parameter name="dateQuestionBR" type="VARCHAR"   
>>> length="10" direction="in"/>
>>> <procedure-parameter name="codeForecast" type="VARCHAR"  
>>> length="10"  direction="in"/>
>>> </procedure>
>>>
>>> and the declation of the procedure is :
>>>
>>> CREATE OR REPLACE PROCEDURE GETEXAVALBR(
>>> valBr OUT varchar,
>>> idDevice IN varchar,
>>> codeMcoEnt IN varchar,
>>> dateQuestionBR IN varchar,
>>> codeForecast IN varchar
>>> ) IS
>>>
>>> here is the trace in tomcat :
>>> QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind: '[OUT]',   
>>> 'NA485', '2', '01/02/2004', '18']
>>> I don't know if the binding is correct but I always have the  
>>> same  error although i'tried a lot of things.
>>> here is the PL/SQL error
>>> PLS-00306: wrong number or types of arguments in call to  
>>> 'GETEXAVALBR'
>>>
>>> I've no Idea left
>>> Can anyone rescue me???? :))
>>> Thanks
>>>
>>>
>>>
>>
>
>
>


Re: ProcedureQuery problem

Posted by Marie Goutière <sw...@hotmail.com>.
Thanks
you're it's quite ok but in Tomcat log there a little problem
QueryLogger: === updated 1 row. appears without stopping.
Is that normal???
My proc doesn't update anything :'(
I don't understand

Thanks
Marie

>From: Andrus Adamchik <an...@objectstyle.org>
>Reply-To: cayenne-user@incubator.apache.org
>To: cayenne-user@incubator.apache.org
>Subject: Re: ProcedureQuery problem
>Date: Mon, 27 Mar 2006 20:21:53 +0400
>
>Hi Marie,
>
>I noticed a mismatch between your procedure definition and Cayenne  
>mapping:
>
><procedure name="GETEXAVALBR" returningValue="true">
>
>"returningValue" should only be "true" for Oracle *functions*, not  
>procedures. Try unchecking the corresponding checkbox in the Modeler.
>
>Andrus
>
>
>
>
>On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:
>
>>Hello
>>I've a problem pl/sql with a ProcedureQuery.
>>here's my java code :
>>ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
>>query.addParameter("idDevice", deviceId);
>>query.addParameter("codeMcoEnt", codeMco);
>>query.addParameter("dateQuestionBR", dateReview);
>>query.addParameter("codeForecast", forecastNum);
>>
>>try{
>>List result =dgctContext.performQuery(query);
>>}
>>catch (Exception e){
>>// PB dans la requete return null
>>DgctLogger.error("DB Request GETEXIST2VALBR Failed");
>>DgctLogger.error(e.toString());
>>}
>>
>>My proc stoc returns only one field of an oracle table
>>
>>in my map.xml you can find :
>><procedure name="GETEXAVALBR" returningValue="true">
>><procedure-parameter name="valBr" type="VARCHAR" length="10"  
>>direction="out"/>
>><procedure-parameter name="idDevice" type="VARCHAR" length="10"  
>>direction="in"/>
>><procedure-parameter name="codeMcoEnt" type="VARCHAR" length="2"  
>>direction="in"/>
>><procedure-parameter name="dateQuestionBR" type="VARCHAR"  length="10" 
>>direction="in"/>
>><procedure-parameter name="codeForecast" type="VARCHAR" length="10"  
>>direction="in"/>
>></procedure>
>>
>>and the declation of the procedure is :
>>
>>CREATE OR REPLACE PROCEDURE GETEXAVALBR(
>>valBr OUT varchar,
>>idDevice IN varchar,
>>codeMcoEnt IN varchar,
>>dateQuestionBR IN varchar,
>>codeForecast IN varchar
>>) IS
>>
>>here is the trace in tomcat :
>>QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind: '[OUT]',  'NA485', 
>>'2', '01/02/2004', '18']
>>I don't know if the binding is correct but I always have the same  error 
>>although i'tried a lot of things.
>>here is the PL/SQL error
>>PLS-00306: wrong number or types of arguments in call to 'GETEXAVALBR'
>>
>>I've no Idea left
>>Can anyone rescue me???? :))
>>Thanks
>>
>>
>>
>



Re: ProcedureQuery problem

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Marie,

I noticed a mismatch between your procedure definition and Cayenne  
mapping:

<procedure name="GETEXAVALBR" returningValue="true">

"returningValue" should only be "true" for Oracle *functions*, not  
procedures. Try unchecking the corresponding checkbox in the Modeler.

Andrus




On Mar 27, 2006, at 8:16 PM, Marie Goutière wrote:

> Hello
> I've a problem pl/sql with a ProcedureQuery.
> here's my java code :
> ProcedureQuery query = new ProcedureQuery("GETEXAVALBR");
> query.addParameter("idDevice", deviceId);
> query.addParameter("codeMcoEnt", codeMco);
> query.addParameter("dateQuestionBR", dateReview);
> query.addParameter("codeForecast", forecastNum);
>
> try{
> List result =dgctContext.performQuery(query);
> }
> catch (Exception e){
> // PB dans la requete return null
> DgctLogger.error("DB Request GETEXIST2VALBR Failed");
> DgctLogger.error(e.toString());
> }
>
> My proc stoc returns only one field of an oracle table
>
> in my map.xml you can find :
> <procedure name="GETEXAVALBR" returningValue="true">
> <procedure-parameter name="valBr" type="VARCHAR" length="10"  
> direction="out"/>
> <procedure-parameter name="idDevice" type="VARCHAR" length="10"  
> direction="in"/>
> <procedure-parameter name="codeMcoEnt" type="VARCHAR" length="2"  
> direction="in"/>
> <procedure-parameter name="dateQuestionBR" type="VARCHAR"  
> length="10" direction="in"/>
> <procedure-parameter name="codeForecast" type="VARCHAR" length="10"  
> direction="in"/>
> </procedure>
>
> and the declation of the procedure is :
>
> CREATE OR REPLACE PROCEDURE GETEXAVALBR(
> valBr OUT varchar,
> idDevice IN varchar,
> codeMcoEnt IN varchar,
> dateQuestionBR IN varchar,
> codeForecast IN varchar
> ) IS
>
> here is the trace in tomcat :
> QueryLogger: {? = call GETEXAVALBR(?, ?, ?, ?)} [bind: '[OUT]',  
> 'NA485', '2', '01/02/2004', '18']
> I don't know if the binding is correct but I always have the same  
> error although i'tried a lot of things.
> here is the PL/SQL error
> PLS-00306: wrong number or types of arguments in call to 'GETEXAVALBR'
>
> I've no Idea left
> Can anyone rescue me???? :))
> Thanks
>
>
>