RE: Stored procedure question ?

From: Marc Gabriel-Willem (marc.gabriel-wille..ide-international.com)
Date: Tue May 15 2007 - 03:53:15 EDT

  • Next message: Andrus Adamchik: "Re: Stored procedure question ?"

    Hello,

    I removed the first parameter and the "returningValue" flag ... and
    indeed it is working properly. I'm really surprised because I used the
    "reengineer database schema" function to create the mapping file.

    Is it a problem from the modeler?

    I've another question for you.

    In MS sqlserver, we have the following stored procedure:

    CREATE procedure [dbo].[spTestGet2]..s_cursor CURSOR VARYING OUTPUT
    AS
    SET ..s_cursor = CURSOR FOR select id, data, lastupdate, description
    from tTest
    OPEN..s_cursor
    GO

    Following mapping has been done using the modeler:
    <procedure name="spTestGet2" schema="dbo" catalog="spp"
    returningValue="true">
                    <procedure-parameter name=..ETURN_VALUE" type="INTEGER"
    length="4"/>
                    <procedure-parameter name=..s_cursor" type="INTEGER"
    length="4" direction="in_out"/>
    </procedure>

    By the way, for the ..eturn_value", I've the following warning: missing
    direction.

    I removed the first parameter in order to fix that warning.
    Nevertheless, the performGenericQuery function throws an exception:
    ...
    ProcedureQuery query = new ProcedureQuery("spTestGet2");
    QueryResponse result = context.performGenericQuery(query);
    ...

    The exception:
    Caused by: java.sql.SQLException: Operand type clash: int is
    incompatible with cursor
    ...

    For information, I'm using the "JTDS 1.2" driver.

    Thank you for your help.

    Regards,
    Marc

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Monday, May 14, 2007 4:04 PM
    To: use..ayenne.apache.org
    Subject: Re: Stored procedure question ?

    This doesn't make sense to me either. So what happens of you remove
    the first parameter and set "returningValue" to false?

    Andrus

    On May 14, 2007, at 4:58 PM, Marc Gabriel-Willem wrote:

    > <procedure name="spViewCustomer" schema="dbo" returningValue="true">
    > <procedure-parameter name="returnValue" type="INTEGER"
    > direction="in"/>
    > <procedure-parameter name="id" type="INTEGER" direction="in"/>
    > <procedure-parameter name="user" type="VARCHAR" length="25"
    > direction="in"/>
    > </procedure>
    >
    > ...
    >
    >
    >
    > I've no problem with the "id" and "user" parameters. But I really
    > do not
    > understand why I have to set my "returnValue" as INTEGER with the
    > direction "IN"... I tried with other options but without any success.



    This archive was generated by hypermail 2.0.0 : Tue May 15 2007 - 03:53:52 EDT